You are here

function _webform_validate_email in Webform 5.2

Same name and namespace in other branches
  1. 5 components/email.inc \_webform_validate_email()
  2. 6.3 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 Forms API Validation function. Validates the entered values from email components on the client-side form.

Parameters

$formelement: An array of information describing the component, directly correlating to the webform_component database schema.

Return value

True if successful, calls a form_set_error if the email is not valid.

File

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

Code

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