You are here

function form_validate_email in Form Builder 6

Same name and namespace in other branches
  1. 7.2 form_builder.module \form_validate_email()
  2. 7 form_builder.module \form_validate_email()

Generic validation function to check for a valid e-mail value.

File

./form_builder.module, line 402
form_builder.module Generic form building framework and user interface.

Code

function form_validate_email(&$element, &$form_state) {
  if (empty($element['#value'])) {
    return;
  }
  if (valid_email_address($element['#value'])) {
    form_error($element, t('The %title field value must be a valid e-mail address.', array(
      '%title' => $element['#title'],
    )));
  }
}