You are here

function _webform_validate_email in Webform 5

Same name and namespace in other branches
  1. 5.2 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 91

Code

function _webform_validate_email($formelement, $name) {
  if (!empty($formelement['#value']) && !valid_email_address($formelement['#value'])) {
    form_set_error($name, t("'%value' is not a valid email address", array(
      '%value' => $formelement['#value'],
    )));
  }
}