--- nodewords.admin.inc.orig	2008-12-04 17:52:29.000000000 -0500
+++ nodewords.admin.inc	2008-12-04 18:09:34.000000000 -0500
@@ -1,5 +1,5 @@
 <?php
-/* $Id: nodewords.admin.inc.orig,v 1.1 2008/12/04 22:52:29 gengel Exp $ */
+/* $Id: nodewords.admin.inc,v 1.2 2008/12/04 22:33:17 gengel Exp $ */
 
 /**
  * @file
@@ -11,11 +11,14 @@
  */
 function nodewords_admin_settings_form() {
   $settings = _nodewords_get_settings();
-  $form = array();
+  $form = array(
+    '#submit' => array('nodewords_admin_settings_submit'),
+  );
 
   $form['nodewords'] = array(
     '#tree' => TRUE,
   );
+
   $form['nodewords']['global'] = array(
     '#tree' => TRUE,
   );
@@ -93,6 +96,11 @@ function nodewords_admin_settings_form()
     '#description' => t('The maximum number of characters the content of a meta tag can contain.'),
   );
 
+  $form['nodewords']['db_max_size'] = array(
+    '#type' => 'value',
+    '#value' => $settings['db_max_size'],
+  );
+
   $form['nodewords']['edit'] = array(
     '#type' => 'fieldset',
     '#title' => t('Tags to show on edit form'),
@@ -139,9 +147,41 @@ function nodewords_admin_settings_form()
     '#description' => t('Check this option if you want to use the <a href="!front-page-url" title="Meta tags for front page">meta tags for the front page</a> even if the <a href="!site-settings-url" title="Site information">default front page</a> specified is a view, panel or node - in this case, the meta tags specified for the view, panel or node will be ignored. If you want to use the meta tags of the view, panel or node instead, uncheck this option. If unsure, select this option and specify the meta tags you want on the <a href="!front-page-url" title="Meta tags for front page">meta tags for the front page</a>.', array('!front-page-url' => url('admin/content/nodewords/frontpage'), '!site-settings-url' => url('admin/settings/site-information'))),
   );
 
-  return system_settings_form($form);
+  $form = system_settings_form($form);
+  return $form;
+}
+
+
+/**
+ * Custom submit handler for settings form
+ **/
+function nodewords_admin_settings_submit($form, &$form_state) {
+  
+  $info = variable_get('nodewords', array());
+
+  $new_max = $form_state['values']['nodewords']['max_size'];
+  $old_max = $info['db_max_size'];
+
+  if($new_max > $old_max) {
+    $ret = array();
+    
+    db_change_field($ret, 'nodewords', 'content', 'content',
+                    array(
+                      'type' => 'varchar',
+                      'length' => $new_max,
+                      'not null' => FALSE,
+                      'default' => '',
+                      'description' => t('Content of meta tag value.'),
+                    )
+    );
+
+    $form_state['values']['nodewords']['db_max_size'] = $new_max;
+
+  }
 }
 
+
+
 /**
  * Menu callback: front page settings form.
  */
