function _name_validate_varchar_range in Name Field 7
Helper form element validator: integer > 0 && <= 255.
1 string reference to '_name_validate_varchar_range'
- _name_field_settings_form in includes/
name.content.inc - Implements hook_field_settings_form().
File
- includes/
name.content.inc, line 639 - Provides additional Field functionality for the name module.
Code
function _name_validate_varchar_range($element, &$form_state) {
$value = $element['#value'];
$min = isset($element['#min_size']) ? $element['#min_size'] : 1;
if ($value !== '' && (!is_numeric($value) || intval($value) != $value || $value < $min || $value > 255)) {
form_error($element, t('%name must be a positive integer between !min and 255.', array(
'%name' => $element['#title'],
'!min' => $min,
)));
}
}