Form element validation handler for number elements.
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'],
)));
}
}