summaryrefslogtreecommitdiff
path: root/includes/form.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-01-19 17:53:53 +0000
committerDries Buytaert <dries@buytaert.net>2006-01-19 17:53:53 +0000
commit616544667f5c08a81ce915c531e644a286e3d88a (patch)
tree9831d5421d8491158256023bb6d907eae07e4978 /includes/form.inc
parent630e820ed0e735d011864c319b91f666f8c11cf5 (diff)
downloadbrdo-616544667f5c08a81ce915c531e644a286e3d88a.tar.gz
brdo-616544667f5c08a81ce915c531e644a286e3d88a.tar.bz2
- Patch #45281 by flevour/chx: fixed problem with categories not being set properly validated.
Diffstat (limited to 'includes/form.inc')
-rw-r--r--includes/form.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/includes/form.inc b/includes/form.inc
index 6db8a623d..021c76884 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -139,8 +139,9 @@ function drupal_submit_form($form_id, $form, $callback = NULL) {
function _form_validate($elements, $form_id = NULL) {
/* Validate the current input */
if (!$elements['#validated'] && ($elements['#input'] || isset($form_id))) {
- // An empty checkbox returns 0 and an empty textfield returns '' so we use empty().
- // Unfortunately, empty('0') returns TRUE so we need a special check for the '0' string.
+ // An empty textfield returns '' so we use empty(). An empty checkbox
+ // and a textfield could return '0' and empty('0') returns TRUE so we
+ // need a special check for the '0' string.
if ($elements['#required'] && empty($elements['#value']) && $elements['#value'] !== '0') {
form_error($elements, t('%name field is required.', array('%name' => $elements['#title'])));
}
@@ -273,7 +274,7 @@ function _form_builder($form_id, $form) {
$form['#value'] = $edit; // normal element
}
elseif (isset($form['#return_value'])) {
- $form['#value'] = 0; // checkbox unchecked
+ $form['#value'] = '0'; // checkbox unchecked
}
}
if (!isset($form['#value'])) {