Skip navigation
Help

element_validate_integer_positive

7 form.inc element_validate_integer_positive($element, &$form_state)

Helper form element validator: integer > 0.

Related topics

1 call to element_validate_integer_positive()

6 string references to 'element_validate_integer_positive'

File

drupal/includes/form.inc, line 4019

Code

function element_validate_integer_positive($element, &$form_state) {
  $value = $element['#value'];
  if ($value !== '' && (!is_numeric($value) || intval($value) != $value || $value <= 0)) {
    form_error($element, t('%name must be a positive integer.', array('%name' => $element['#title'])));
  }
}