Skip navigation
Help

element_validate_number

7 form.inc element_validate_number($element, &$form_state)

Helper form element validator: number.

Related topics

1 call to element_validate_number()

1 string reference to 'element_validate_number'

File

drupal/includes/form.inc, line 4029

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