Handle hidden fields as if they were integers
authorJoey Schulze <joey@infodrom.org>
Thu, 4 Mar 2010 21:12:59 +0000 (22:12 +0100)
committerJoey Schulze <joey@infodrom.org>
Thu, 4 Mar 2010 21:12:59 +0000 (22:12 +0100)
This might be adjusted when other values than references are stored

ajax/ajax.php

index 9a491c8..4ab5aa2 100644 (file)
@@ -80,7 +80,7 @@ function save($mask)
 
     if ($info['type'] == 'boolean') {
       $update[] = sprintf("%s=%d", $field, $_POST[$field] == 'on'?1:0);
-    } elseif ($info['type'] == 'number' || ($info['type'] == 'select' && $info['options_string'] !== true)) {
+    } elseif ($info['type'] == 'number' || $info['type'] == 'hidden' || ($info['type'] == 'select' && $info['options_string'] !== true)) {
       if (empty($_POST[$field]) && $info['null'] === true)
         $update[] = sprintf("%s=NULL", $field);
       else
@@ -129,7 +129,7 @@ function insert($mask)
     if ($info['type'] == 'boolean') {
       $fields[] = $field;
       $values[] = $_POST[$field] == 'on'?1:0;
-    } elseif ($info['type'] == 'number' || ($info['type'] == 'select' && $info['options_string'] !== true)) {
+    } elseif ($info['type'] == 'number' || $info['type'] == 'hidden' || ($info['type'] == 'select' && $info['options_string'] !== true)) {
       $fields[] = $field;
       if (empty($_POST[$field]) && $info['null'] === true)
        $values[] = 'NULL';