form_error

includes/form.inc, line 834

Versions
4.7 – 7
form_error(&$element, $message = '')

Flag an element as having an error.

Related topics

▾ 7 functions call form_error()

aggregator_categorize_items_validate in modules/aggregator/aggregator.pages.inc
Validate aggregator_categorize_items form submissions.
date_validate in includes/form.inc
Validates the date type to stop dates like February 30, 2006.
example_element_phonenumber_validate in developer/examples/example_element.module
Our element's validation function.
filter_form_validate in modules/filter/filter.module
install_configure_form_validate in ./install.php
Form API validate for the site configuration form.
password_confirm_validate in includes/form.inc
Validate password_confirm element.
_form_validate in includes/form.inc
Performs validation on form elements. First ensures required fields are completed, #maxlength is not exceeded, and selected options were in the list of options given to the user. Then calls user-defined validators.

Code

<?php
function form_error(&$element, $message = '') {
  form_set_error(implode('][', $element['#parents']), $message);
}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.