Skip navigation
Help

element_validate_integer

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

Helper form element validator: integer.

Related topics

1 call to element_validate_integer()

File

drupal/includes/form.inc, line 4009

Code

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