function _clientside_validation_set_regex_pcre in Clientside Validation 6
Same name and namespace in other branches
- 7 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 890 - Add client side validation to a webform.
Code
function _clientside_validation_set_regex_pcre($name, $title, &$js_rules, $expression, $message = '', $type = 'regex pcre') {
$title = variable_get('clientside_validation_prefix', '') . $title . variable_get('clientside_validation_suffix', '');
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;
}