drupal 6 using form api number field
The Elements module provides an HTML5 number field element to the FAPI. You can use it like this:

$form['foo'] = array(
  'type' =&gt; 'numberfield'.
  'title' =&gt; t('Bar'),
  ...
);