function form_get_error

7.x form_get_error($element)
5.x form_get_error($element)
6.x form_get_error($element)
8.x form_get_error($element, array &$form_state)

Returns the error message filed against the given form element.

Form errors higher up in the form structure override deeper errors as well as errors on the element itself.

Related topics

1 call to form_get_error()
_form_set_class in drupal/includes/
Sets a form element's class attribute.


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


function form_get_error($element) {
  $form = form_set_error();
  $parents = array();
  foreach ($element['#parents'] as $parent) {
    $parents[] = $parent;
    $key = implode('][', $parents);
    if (isset($form[$key])) {
      return $form[$key];