HTML5 adds support for a number input field type. It can have a step, a minimum and a maximum. The browser can provide up-down-arrows or a number keyboard, which is especially useful on mobile devices. For browsers that do not support the new input type, the fallback is a simple textfield with just the server side validation.

The element_validate_number(), element_validate_integer() and element_validate_integer_positive() functions have been removed, in favor of a proper HTML5 number element in Form API.

Examples:

Before:

<?php
$form
['count'] = array(
 
'#type' => 'textfield',
 
'#title' => t('Item count'),
 
'#description' => t('Enter a number of items'),
 
'#element_validate' => array('element_validate_integer_positive'),
);
?>

After:

<?php
$form
['count'] = array(
 
'#type' => 'number', // New HTML 5 number type.
 
'#title' => t('Item count'),
 
'#description' => t('Enter a number of items'),
 
'#min' => 0, // Use this to replace element_validate_integer_positive() validation.
               // Having just #type => 'number'
               // already replaces element_validate_integer().
);
?>

See the number element change notification for more information about the new number element type.

Introduced in branch: 
1.0.x
Introduced in version: 
1.0.0