element_validate_integer

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 element_validate_integer($element, &$form_state)

Helper form element validator: integer.

Related topics

Code

includes/form.inc, line 4035

<?php
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'])));
  }
}
?>