summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-10-13 17:08:50 +0000
committerDries Buytaert <dries@buytaert.net>2004-10-13 17:08:50 +0000
commit0261efc8fd547ddcbba77de6bc7e8fb170b1ae59 (patch)
treee4e7570b4197cfbf2758a2f662c041610fa4e498
parent4bc031b13e098be8bacdd13ffe91d6e91eabe90f (diff)
downloadbrdo-0261efc8fd547ddcbba77de6bc7e8fb170b1ae59.tar.gz
brdo-0261efc8fd547ddcbba77de6bc7e8fb170b1ae59.tar.bz2
- Patch #11531 by killes: it was not possible to deselect all choices of a form_checkboxes array.
-rw-r--r--includes/common.inc4
1 files changed, 2 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc
index d35a10d87..066e1840a 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1266,14 +1266,14 @@ function form_checkbox($title, $name, $value = 1, $checked = FALSE, $description
*/
function form_checkboxes($title, $name, $values, $options, $description = NULL, $attributes = NULL, $required = FALSE) {
if (count($options) > 0) {
- if (!isset($values)) {
+ if (!isset($values) || $values == 0) {
$values = array();
}
$choices = '';
foreach ($options as $key => $choice) {
$choices .= '<label class="option"><input type="checkbox" class="form-checkbox" name="edit['. $name .'][]" value="'. $key .'"'. (in_array($key, $values) ? ' checked="checked"' : ''). drupal_attributes($attributes). ' /> '. $choice .'</label><br />';
}
- return theme('form_element', $title, $choices, $description, NULL, $required, _form_get_error($name));
+ return form_hidden($name, 0) . theme('form_element', $title, $choices, $description, NULL, $required, _form_get_error($name));
}
}