function element_validate_integer

Form element validation handler for integer elements.

Related topics

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

File

includes/form.inc, line 4439

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.