function element_validate_number

Form element validation handler for number elements.

Related topics

1 call to element_validate_number()
_element_validate_number in modules/field/field.module
DEPRECATED: Helper form element validator: number.
1 string reference to 'element_validate_number'
number_field_instance_settings_form in modules/field/modules/number/number.module
Implements hook_field_instance_settings_form().

File

includes/form.inc, line 4459

Code

function element_validate_number($element, &$form_state) {
    $value = $element['#value'];
    if ($value != '' && !is_numeric($value)) {
        form_error($element, t('%name must be a number.', array(
            '%name' => $element['#title'],
        )));
    }
}

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