You are here

function _clientside_validation_set_email in Clientside Validation 7

Same name and namespace in other branches
  1. 6 clientside_validation.module \_clientside_validation_set_email()

Set validation rule for email fields.

5 calls to _clientside_validation_set_email()
clientside_validation_field_validation_regular in clientside_validation_field_validation/clientside_validation_field_validation.module
clientside_validation_html5 in clientside_validation_html5/clientside_validation_html5.module
clientside_validation_regular in clientside_validation_form/clientside_validation_form.module
clientside_validation_webform_after_build_recurse in clientside_validation_webform/clientside_validation_webform.module
_clientside_validation_set_fapi_validation in clientside_validation_fapi/clientside_validation_fapi.module
Set fapi validation.

File

./clientside_validation.module, line 1242
Add client side validation to forms.

Code

function _clientside_validation_set_email($name, $title, &$js_rules, $message = '') {
  $title = _clientside_validation_set_title($title);
  $js_rules[$name]['email'] = TRUE;
  $variables = array(
    'message' => empty($message) ? 'The value in !title is not a valid email address.' : $message,
    'placeholders' => empty($message) ? array(
      '!title' => $title,
    ) : array(),
    'error_type' => 'email',
    'element_name' => $name,
  );
  $js_rules[$name]['messages']['email'] = theme('clientside_error', $variables);
}