Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.435 diff -u -F^f -r1.435 common.inc --- includes/common.inc 7 Apr 2005 22:46:55 -0000 1.435 +++ includes/common.inc 12 Apr 2005 19:14:59 -0000 @@ -413,6 +413,20 @@ function fix_gpc_magic() { } /** + * Empty arrays can not be posted through HTML. So we check and fix empty + * form_checkboxes. + */ +function fix_checkboxes() { + if (isset($_POST['form_checkboxes'])) { + foreach ($_POST['form_checkboxes'] as $key) { + if (!array_key_exists($key, $_POST['edit'])) { + $_POST['edit'][$key] = array(); + } + } + } +} + +/** * @name Conversion * @{ * Converts data structures to different types. @@ -1172,9 +1186,8 @@ function form_checkboxes($title, $name, $choices .= '
'; } // Note: because unchecked boxes are not included in the POST data, we - // include a form_hidden() which will be overwritten as soon as there is at - // least one checked box. - return form_hidden($name, 0) . theme('form_element', $title, $choices, $description, NULL, $required, _form_get_error($name)); + // indicate that $name is a form_checkbox. + return '' . theme('form_element', $title, $choices, $description, NULL, $required, _form_get_error($name)); } }