function _webform_numeric_check_data in Webform Validation 6
Same name and namespace in other branches
- 7 webform_validation.validators.inc \_webform_numeric_check_data()
Process the numeric value validation range that was provided in the numeric validator options
1 call to _webform_numeric_check_data()
- webform_validation_webform_validation_validate in ./
webform_validation.validators.inc - Implementation of hook_webform_validation_validate().
File
- ./
webform_validation.validators.inc, line 613 - Provides validation functionality and hooks
Code
function _webform_numeric_check_data($data) {
$range = array(
'min' => NULL,
'max' => NULL,
);
// if no value was specified, don't validate
if ($data == '') {
return $range;
}
// If only one numeric value was specified, this is the min value
if (is_numeric($data)) {
$range['min'] = (int) $data;
}
if (strpos($data, '|') !== FALSE) {
list($min, $max) = explode('|', $data);
if ($min != '' && is_numeric($min)) {
$range['min'] = (int) $min;
}
if ($max != '' && is_numeric($max)) {
$range['max'] = (int) $max;
}
}
return $range;
}