filter_form_validate
- Versions
- 4.7 – 6
filter_form_validate($form)
Code
modules/filter/filter.module, line 858
<?php
function filter_form_validate($form) {
foreach (element_children($form) as $key) {
if ($form[$key]['#value'] == $form[$key]['#return_value']) {
return;
}
}
form_error($form, t('An illegal choice has been detected. Please contact the site administrator.'));
watchdog('form', t('Illegal choice %choice in %name element.', array('%choice' => $form[$key]['#value'], '%name' => empty($form['#title']) ? $form['#parents'][0] : $form['#title'])), WATCHDOG_ERROR);
}
?>Login or register to post comments 
Incorrect?
I am not sure the function signature is correct above. In my tests, the function's first argument simply contains the name of the form, whilst the second, currently not shown in the above example, contains the form array itself. I believe it should be more like:
<?phpfunction filter_form_validate($form_name, $form) {
// Do stuff here. $form contains the form array and we can use element_children() on it if we need to.
}
?>