How do you alter a form error?
Altering strings

To change the text of a single string, the simplest method is to use the String Overrides module. That would allow you to replace the string:


  "!name field is required."


with (for example):


  "The field '!name' is required."


Altering form fields

If you want to make a field not required, use a normal hook_form_alter() implementation:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function mymodule_form_node_form_alter(&amp;$form, &amp;$form_state) {
  $node = $form['#node'];
  if ($node-&gt;type == 'my_custom_type') {
    $form['title']['#required'] = FALSE;
  }
}


Changing the way a form is validated

Forms have validation functions specified in the $form['#validate'] array. And form elements have functions specified in $form['element_key']['#element_validate'].

You can specify your own like this:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function mymodule_form_node_form_alter(&amp;$form, &amp;$form_state) {
  $form['title']['#element_validate'][] = 'mymodule_validate_node_title';
}

/**
 * Validate the node title to prevent ALL CAPS.
 */
function mymodule_validate_node_title($element, &amp;$form_state, $form) {
  if (preg_match('/^[A-Z]+$/', $element['#value'])) {
    form_error($element, t('You may not enter titles in ALL CAPS.'));
  }
}