function _clientside_validation_set_number in Clientside Validation 6
Same name and namespace in other branches
- 7 clientside_validation.module \_clientside_validation_set_number()
Set validation rule for number fields.
2 calls to _clientside_validation_set_number()
- clientside_validation_cck in clientside_validation_form/
clientside_validation_form.module - clientside_validation_webform_add_webform_validation in clientside_validation_webform/
clientside_validation_webform.module - Support webform_validation
File
- ./
clientside_validation.module, line 377 - Add client side validation to a webform.
Code
function _clientside_validation_set_number($name, $title, &$js_rules) {
$title = variable_get('clientside_validation_prefix', '') . $title . variable_get('clientside_validation_suffix', '');
$js_rules[$name]['digits_negative'] = TRUE;
$variables = array(
'message' => '!title field accepts only numbers.',
'placeholders' => array(
'!title' => $title,
),
'error_type' => 'number',
'element_name' => $name,
);
$js_rules[$name]['messages']['digits_negative'] = theme('clientside_error', $variables);
}