form_get_error
function form_get_error
form_get_error($element)
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
File
- includes/form.inc, line 1689
- Functions for form and batch generation and processing.
Code
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]; } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!form.inc/function/form_get_error/7.x