Definition

form_set_error($name = NULL, $message = '')
drupal-5/includes/form.inc, line 592

Description

File an error against a form element. If the name of the element is edit[foo][bar] then you may pass either foo or foo][bar as $name foo will set an error for all its children.

Related topics

Namesort iconDescription
Form generationFunctions to enable the processing and display of HTML forms.

Code

<?php
function form_set_error($name = NULL, $message = '') {
  static $form = array();
  if (isset($name) && !isset($form[$name])) {
    $form[$name] = $message;
    if ($message) {
      drupal_set_message($message, 'error');
    }
  }
  return $form;
}
?>