function _clientside_validation_set_specific_values in Clientside Validation 7
Same name and namespace in other branches
- 6 clientside_validation.module \_clientside_validation_set_specific_values()
Set validation rule for fields that consist of one or more of specific values (e.g. string with only a, b and c in it).
2 calls to _clientside_validation_set_specific_values()
- hook_clientside_validation_rule_alter in ./
clientside_validation.api.php - Some modules allow users to define extra validation rules defined in a hook. (e.g hook_webform_validation_validators()). To support these custom rules, clientside validation has its own hook, hook_clientside_validation_rule_alter. We had to use an…
- _clientside_validation_set_fapi_validation in clientside_validation_fapi/
clientside_validation_fapi.module - Set fapi validation.
File
- ./
clientside_validation.module, line 1058 - Add client side validation to forms.
Code
function _clientside_validation_set_specific_values($name, $title, $values, &$js_rules, $message = '') {
$js_rules[$name]['specificVals'] = $values;
$title = _clientside_validation_set_title($title);
if (empty($message)) {
$variables = array(
'message' => '!title field must consist of following elements only: !elements.',
'placeholders' => array(
'!title' => $title,
'!elements' => implode(', ', $values),
),
'error_type' => 'specific values',
'element_name' => $name,
);
}
else {
$variables = array(
'message' => $message,
'error_type' => 'specific values',
'element_name' => $name,
);
}
$message = theme('clientside_error', $variables);
$js_rules[$name]['messages']['specificVals'] = $message;
}