You are here

function element_validate_number in Drupal 7

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 4418
Functions for form and batch generation and processing.

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