input ElementsThe input element is declared by the XHTML 1.1
Forms Module
There are ten types of input element, all of which are
form controls. Each performs a significantly different function, however,
and are listed below in alphabetical order:
input type="button" | A form push-button (with no default action) |
|---|---|
input type="checkbox" | A checkbox (may be checked or unchecked independently of other form controls) |
input type="file" | A file upload control |
input type="hidden" | A hidden input parameter |
input type="image" | A graphical form submit button |
input type="password" | A password input field |
input type="radio" | A radio button (only one of a set of radio buttons can be "on" at any one time) |
input type="reset" | A form reset button |
input type="submit" | A form submit button |
input type="text" | A text input field |
If specified, the type attribute of the input element must have one of the values above (although the values
"button", "file" and "image" are not allowed if using the
*W3C XHTML 1.1 Basic Forms Module).
If omitted, the default value of "text" is assumed.
In addition to the type attribute (and to all the standard
Common Attributes) there are a number of specific attributes declared on
input elements. These attributes are listed in the first column of the table below and will validate on
any input element but, due to the vastly differing functions of these
elements, most of the attributes have meaning only on a certain number of them.
The table shows which of the attributes are actually applicable (in a reliable fashion) to which of the elements.
Note that disabled and readonly are not allowed if you are using the
*W3C XHTML 1.1 Basic Forms Module.
| Attribute | text | password | checkbox | radio | submit | reset | hidden | button | file | image |
|---|---|---|---|---|---|---|---|---|---|---|
name |
YES | YES | YES | YES | YES | YES | YES | YES | YES | YES |
value |
YES | YES | YES | YES | YES | YES | YES | YES | NO | NO |
disabled |
YES | YES | YES | YES | YES | YES | YES | YES | YES | YES |
readonly |
YES | YES | NO | NO | NO | NO | NO | NO | NO | NO |
size |
YES | YES | NO | NO | NO | NO | NO | NO | YES | NO |
maxlength |
YES | YES | NO | NO | NO | NO | NO | NO | NO | NO |
checked |
NO | NO | YES | YES | NO | NO | NO | NO | NO | NO |
accept |
NO | NO | NO | NO | NO | NO | NO | NO | YES | NO |
src |
NO | NO | NO | NO | NO | NO | NO | NO | NO | YES |
alt |
NO | NO | NO | NO | NO | NO | NO | NO | NO | YES |
ismap |
NO | NO | NO | NO | NO | NO | NO | NO | NO | YES |
usemap |
NO | NO | NO | NO | NO | NO | NO | NO | NO | YES |
accesskey |
YES | YES | YES | YES | YES | YES | NO | YES | YES | YES |
tabindex |
YES | YES | YES | YES | YES | YES | NO | YES | YES | YES |
onfocus |
YES | YES | YES | YES | YES | YES | NO | YES | YES | YES |
onblur |
YES | YES | YES | YES | YES | YES | NO | YES | YES | YES |
onchange |
YES | YES | YES | YES | NO | NO | NO | NO | YES | NO |
onselect |
YES | YES | NO | NO | NO | NO | NO | NO | YES | NO |