You are here

function elements_validate_email in Elements 7

Form element validation handler for #type 'email'.

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

1 string reference to 'elements_validate_email'
elements_element_info in ./elements.module
Implements hook_element_info().

File

./elements.module, line 246

Code

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