You are here

function _name_validate_integer_positive in Name Field 6

Custom validation of settings values.

2 string references to '_name_validate_integer_positive'
name_field_settings in ./name.module
Implementation of hook_field_settings().
name_widget_settings in ./name.module
Implementation of hook_widget_settings().

File

./name.module, line 763
Defines an API for displaying and inputing names.

Code

function _name_validate_integer_positive($element, &$form_state) {
  $value = $element['#value'];
  if ($value && !is_numeric($value) || $value < 1 || $value > 255) {
    form_set_error(implode('][', $element['#array_parents']), t('%label must be a number between 1 and 255.', array(
      '%label' => $element['#title'],
    )));
  }
}