1 form.inc form_validate_email(&$element, &$form_state)

Form element validation handler for #type 'email'.

Note that #maxlength and #required is validated by _form_validate() already.

Related topics

File

core/includes/form.inc, line 4101
Functions for form and batch generation and processing.

Code

function form_validate_email(&$element, &$form_state) {
  $value = trim($element['#value']);
  form_set_value($element, $value, $form_state);

  if ($value !== '' && !valid_email_address($value)) {
    form_error($element, t('The e-mail address %mail is not valid.', array('%mail' => $value)));
  }
}