form_error

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

Flag an element as having an error.

Related topics

▾ 6 functions call form_error()

aggregator_page_list_validate in modules/aggregator/aggregator.module
date_validate in includes/form.inc
Validates the date type to stop dates like February 30, 2006.
example_element_validate in developer/examples/example_element.module
Our element's validation function.
filter_form_validate in modules/filter/filter.module
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

includes/form.inc, line 631

<?php
function form_error(&$element, $message = '') {
  $element['#error'] = TRUE;
  form_set_error(implode('][', $element['#parents']), $message);
}
?>
Login or register to post comments
 
 

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.