--- includes/form.inc.orig 2010-07-16 14:14:34.078125000 +0200
+++ includes/form.inc 2010-07-16 17:55:35.453125000 +0200
@@ -682,7 +682,9 @@ function _form_validate($elements, &$for
// A simple call to empty() will not cut it here as some fields, like
// checkboxes, can return a valid value of '0'. Instead, check the
// length if it's a string, and the item count if it's an array.
- if ($elements['#required'] && (!count($elements['#value']) || (is_string($elements['#value']) && strlen(trim($elements['#value'])) == 0))) {
+ // An unchecked checkbox has a #value of integer 0, different than string
+ // '0', which could be a valid value.
+ if ($elements['#required'] && (!count($elements['#value']) || (is_string($elements['#value']) && strlen(trim($elements['#value'])) == 0) || $elements['#value'] === 0)) {
form_error($elements, $t('!name field is required.', array('!name' => $elements['#title'])));
}
@@ -1877,6 +1879,7 @@ function theme_item($element) {
* @ingroup themeable
*/
function theme_checkbox($element) {
+ $t = get_t();
_form_set_class($element, array('form-checkbox'));
$checkbox = '';
if (!is_null($element['#title'])) {
- $checkbox = '';
+ $title = $element['#title'];
+ $required = !empty($element['#required']) ? '*' : '';
+ $checkbox = '';
}
unset($element['#title']);