You are here

function _webform_validate_email in Webform 6.3

Same name and namespace in other branches
  1. 5.2 components/email.inc \_webform_validate_email()
  2. 5 components/email.inc \_webform_validate_email()
  3. 6.2 components/email.inc \_webform_validate_email()
  4. 7.4 components/email.inc \_webform_validate_email()
  5. 7.3 components/email.inc \_webform_validate_email()

A Drupal Form API Validation function. Validates the entered values from email components on the client-side form.

Parameters

$form_element: The e-mail form element.

$form_state: The full form state for the webform.

Return value

None. Calls a form_set_error if the e-mail is not valid.

1 string reference to '_webform_validate_email'
_webform_render_email in components/email.inc
Implements _webform_render_component().

File

components/email.inc, line 196
Webform module email component.

Code

function _webform_validate_email($form_element, &$form_state) {
  $component = $form_element['#webform_component'];
  $value = trim($form_element['#value']);
  if ($value !== '' && !valid_email_address($value)) {
    form_error($form_element, t('%value is not a valid email address.', array(
      '%value' => $value,
    )));
  }
  else {
    form_set_value($form_element, $value, $form_state);
  }
}