function element_validate_integer

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

Form element validation handler for integer elements.

Related topics

1 call to element_validate_integer()
_element_validate_integer in drupal/modules/field/field.module
DEPRECATED: Helper form element validator: integer.
2 string references to 'element_validate_integer'
form_process_weight in drupal/includes/form.inc
Expands a weight element into a select element.
_poll_choice_form in drupal/modules/poll/poll.module

File

drupal/includes/form.inc, line 4254
Functions for form and batch generation and processing.

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