function form_error

7.x form.inc form_error(&$element, $message = '')
5.x form.inc form_error(&$element, $message = '')
6.x form.inc form_error(&$element, $message = '')
8.x form.inc form_error(&$element, array &$form_state, $message = '')

Flags an element as having an error.

Related topics

28 calls to form_error()
date_validate in drupal/includes/form.inc
Validates the date type to prevent invalid dates (e.g., February 30, 2006).
element_validate_integer in drupal/includes/form.inc
Form element validation handler for integer elements.
element_validate_integer_positive in drupal/includes/form.inc
Form element validation handler for integer elements that must be positive.
element_validate_number in drupal/includes/form.inc
Form element validation handler for number elements.
field_default_form_errors in drupal/modules/field/field.form.inc
Transfer field-level validation errors to widgets.

... See full list

File

drupal/includes/form.inc, line 1697
Functions for form and batch generation and processing.

Code

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