function _clientside_validation_set_regex_pcre in Clientside Validation 7
Same name and namespace in other branches
- 6 clientside_validation.module \_clientside_validation_set_regex_pcre()
Set validation rule for fields with regex validation from webform_validation
1 call to _clientside_validation_set_regex_pcre()
- _clientside_validation_set_fapi_validation in clientside_validation_fapi/
clientside_validation_fapi.module - Set fapi validation.
File
- ./
clientside_validation.module, line 1163 - Add client side validation to forms.
Code
function _clientside_validation_set_regex_pcre($name, $title, &$js_rules, $expression, $message = '', $type = 'regex pcre') {
$title = _clientside_validation_set_title($title);
if (empty($message)) {
$variables = array(
'message' => '!title field does not match the required pattern.',
'placeholders' => array(
'!title' => $title,
),
'error_type' => $type,
'element_name' => $name,
);
}
else {
$variables = array(
'message' => $message,
'error_type' => $type,
'element_name' => $name,
);
}
$message = theme('clientside_error', $variables);
$js_rules[$name]['regexMatchPCRE']['expressions'][] = $expression;
$js_rules[$name]['regexMatchPCRE']['messages'][] = $message;
}