function element_validate_number

Form element validation handler for number elements.

Related topics

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

File

drupal/includes/form.inc, line 4396
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'],
    )));
  }
}