INPUT
The INPUT element represents a field whose contents may be
edited by the user. It has the following attributes.
- NAME
- Symbolic name used when transferring the form's contents.
This attribute is always needed and should uniquely identify
this field.
- TYPE
- Defines the type of data the field accepts.
Defaults to free text.
- SIZE
- Specifies the size or precision of the field according to
its type.
- MAXLENGTH
- The maximum number of characters that will be accepted as
input. This can be greater that specified by SIZE ,
in which case the field will scroll appropriately.
The default is unlimited.
- VALUE
- The initial value for the field, or the value when checked
for checkboxes and radio buttons. This attribute is required
for radio buttons.
- SRC
- A URL or URN specifying an image - for use only with TYPE=IMAGEMAP.
- ALIGN
- Vertical alignment of the image - for use only with TYPE=IMAGEMAP.
Propsed
- CHECKED
- When present indicates that a checkbox or radio button is
selected.
- DISABLED
- When present indicates that this field is temporarily disabled.
Browsers should show this by "greying it" out in some manner.
- ERROR
- When present indicates that the field's initial value is
in error in some way, e.g. because it is inconsistent with the
values of other fields. Servers should include an explanatory
error message with the form's text.
Types
The following types of fields can be defined with the TYPE
attribute :
- TEXT
- Single line text entry fields. Use the SIZE attribute to
specify the visible width in characters,
e.g. SIZE="24" for a 24 character field.
The MAX attribute can be used to specify an upper limit to the
number of characters that can be entered into a text field,
e.g. MAX=72 . Use the TEXTAREA element for text fields which
can accept multiple lines (see below).
- HIDDEN
- No field is presented to the user, but the content of the
field is sent with the submitted form. This value may be used
to transmit state information about client/server interaction.
- CHECKBOX
- Used for simple Boolean attributes, or for attributes which
can take multiple values at the same time.
The latter is represented by a number of checkbox fields each
of which has the same NAME .
- RADIO
- For attributes which can take a single value from a set of
alternatives. Each radio button field in the group should be
given the same NAME .
- SUBMIT
- This is a button that when pressed submits the form.
It offers authors control over the location of this button.
You can use an image as a submit button by specifying a URL with
the SRC attribute.
- RESET
- This is a button that when pressed resets the form's fields
to their initial values as specified by the VALUE attribute.
You can use an image as a reeset button by specifying a URL with
the SRC attribute.
Proposed types
- RANGE
- This allows you to specify an integer range with the MIN
and MAX attributes, e.g. MIN=1 MAX=100 .
Users can select any value in this range.
- INT
- For entering integer numbers, the maximum number of digits
can be specified with the SIZE attribute (excluding the sign
character), e.g. size=3 for a three digit number.
- FLOAT
- For fields which can accept floating point numbers.
- SCRIBBLE
- A field upon which you can write with a pen or mouse.
The size of the field in millimeters is given as SIZE= width
, height. The units are absolute as they relate to the dimensions
of the human hand, rather than pixels of varying resolution.
The scribble may involve time and pressure data in addition to
the basic ink data. You can use scribble for signatures or sketches.
The field can be initialised by setting the SRC attribute to
a URL which contains the ink *2 . The VALUE attribute is ignored.
- AUDIO
- This provides a way of entering spoken messages into a form.
Browsers might show an icon which when clicked pops-up a set
of tape controls that you can use to record and replay messages.
The initial message can be set by specifying a URL with the SRC
attribute. The VALUE attribute is ignored.
Obsolete types
- DATE
- Fields which can accept a recognized date format.
- URL
- For fields which expect document references as URLs or URNs.
- IMAGE
- This allows you to specify an image field upon which you
can click with a pointing device. The SRC and ALIGN attributes
are exactly the same as for the IMG and IMAGE elements.
The symbolic names for the x and y coordinates of the click event
are specified with .x and .y for the given with the NAME attribute.
The VALUE attribute is ignored.
When you need to let users enter more than one line of text,
you should use the TEXTAREA element.