From b3451d0274dcae62f72e594747278ab19697afe5 Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Wed, 13 Oct 2004 17:21:06 +0000 Subject: Adding a note about the usage of form_hidden inside form_checkbox and form_checkboxes. --- includes/common.inc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index 066e1840a..1984796c9 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1240,6 +1240,8 @@ function form_checkbox($title, $name, $value = 1, $checked = FALSE, $description if (!is_null($title)) { $element = ''; } + // Note: because unchecked boxes are not included in the POST data, we include + // a form_hidden() which will be overwritten for a checked box. return form_hidden($name, 0) . theme('form_element', NULL, $element, $description, $name, $required, _form_get_error($name)); } @@ -1273,6 +1275,9 @@ function form_checkboxes($title, $name, $values, $options, $description = NULL, foreach ($options as $key => $choice) { $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)); } } -- cgit v1.2.3