Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
61654466
Commit
61654466
authored
Jan 19, 2006
by
Dries
Browse files
- Patch
#45281
by flevour/chx: fixed problem with categories not being set properly validated.
parent
630e820e
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/form.inc
View file @
61654466
...
...
@@ -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'
]))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment