function _clientside_validation_set_number_decimal in Clientside Validation 7
Same name and namespace in other branches
- 6 clientside_validation.module \_clientside_validation_set_number_decimal()
Set validation rule for decimal fields.
6 calls to _clientside_validation_set_number_decimal()
- 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_add_webform_validation in clientside_validation_webform/
clientside_validation_webform.module - Support webform_validation
- clientside_validation_webform_after_build_recurse in clientside_validation_webform/
clientside_validation_webform.module
File
- ./
clientside_validation.module, line 585 - Add client side validation to forms.
Code
function _clientside_validation_set_number_decimal($name, $title, $decimalpoint, &$js_rules, $message = '') {
$title = _clientside_validation_set_title($title);
if ($decimalpoint == '.') {
$js_rules[$name]['number'] = TRUE;
$variables = array(
'message' => empty($message) ? '!title field accepts only numbers (use a \'.\' as decimal point).' : $message,
'placeholders' => empty($message) ? array(
'!title' => $title,
) : array(),
'error_type' => 'number',
'element_name' => $name,
);
$js_rules[$name]['messages']['number'] = theme('clientside_error', $variables);
}
else {
$js_rules[$name]['numberDE'] = TRUE;
$variables = array(
'message' => empty($message) ? '!title field accepts only numbers (use a \',\' as decimal point).' : $message,
'placeholders' => empty($message) ? array(
'!title' => $title,
) : array(),
'error_type' => 'number',
'element_name' => $name,
);
$js_rules[$name]['messages']['numberDE'] = theme('clientside_error', $variables);
}
}