The Comprehensive HTML Cross Reference


Forms Tags

This document describes tags used to design and implement interactive forms on a web page.

Click here to skip over the explanatory material at the top of the page and jump straight to the tags.

This table:

Support: HTML:2.0, 3.0, 3.2  Netscape:1.1+  MS Explorer:1.0+
and these icons:
(HTML 3.0 Only) (HTML 3.2 Only) (Netscape Extension) (Microsoft Extension) (Microsoft Extension 3.0)

alert you to tags and attributes that are not supported by all browsers. The support page explains the table and the icons in detail.

CDI Home Page

Finding your way around...

Not all HTML tags are in this single file. The comprehensive list has been split into the following eight categories:

We have also provided several indexes to help you navigate through this reference. In addition to our main indexes (the compact index and the complete index), there are four other indexes that list the tags according to the standards and browsers that support them.

CDI Home Page

The Comprehensive HTML Cross Reference was created as a service to the Internet community. It represents a joint effort of Scott Williams of CDI Corporate Education Services and Kate Gregory of Gregory Consulting and is fully protected by Copyright © 1995 - 2001. Please report any errors or omissions to Kate Gregory.

CDI Home Page

Form


<FORM ACTION=action base> form tags </FORM>
<FORM METHOD=
method> form tags </FORM>
<FORM ENCTYPE=
media type> form tags </FORM>
(Netscape Extension) (Microsoft Extension 3.0) <FORM ACTION=action base TARGET="target window name"> form tags </FORM>
(HTML 3.0 Only)<FORM SCRIPT=
URL> form tags </FORM>

The form tag introduces a form, which is made up of INPUT elements, described in the sections that follow. A form may be inside structural HTML tags and may also contain structural tags. Using tables and other elements a form can take on various shapes and looks.

The ACTION attribute defaults to the document's base address.

The METHOD attribute can be GET or POST. GET specifies a query form, used to get data from a server. POST specifies a form that gives information to the server and perhaps causes a database to be updated or a message to be sent.

The SCRIPT attribute points to a script to be run. The browser must be able to run the type of script that is specified.

The default media type is 'application/x-www-form-urlencoded', which specifies how the browser puts the user responses on the form together to form a response URL that is then submitted to the server. For more on the CGI compliant scripts that process the form, check the CGI documentation.

(Netscape Extension) (Microsoft Extension 3.0) If Target is specified then the output document will be loaded into the window specified by "target window name". The following are the predefined target names:

_blank
Will cause the link to be loaded into a new blank window.
_self
Will cause the link to be loaded into the same window the link was in.
_parent
Will cause the link to be loaded into the parent of this document.
_top
Will cause the link to be loaded into the full body of this window.

CDI Home Page

Form Input Check Box


<INPUT TYPE=CHECKBOX NAME=name VALUE=value>
<INPUT TYPE=CHECKBOX NAME=
name VALUE=value CHECKED>

The checkbox type input tag specifies a boolean choice within the form that contains it. If more than one checkbox appears in the form with the same name the user can select none, one or several of the choices. The NAME attribute is a required field and is used to identify the data for the field. The VALUE attribute specifies the value that is returned if the box is checked. If the CHECKED attribute is specified, the box is initially selected.

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.

CDI Home Page

Form Input File
Support: HTML:3.2 Netscape:No Support MS Explorer:No Support


<INPUT TYPE=FILE NAME=name ACCEPT=mime type list>

The file type input tag allows the user to attach one or more files to the form for submission. The NAME attribute is a required field and is used to identify the data for the field. The ACCEPT attribute is a list of mime types that will be accepted. (e.g. "image/*" or "image/gif, image/jpeg").

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.

CDI Home Page

Form Input Hidden


<INPUT TYPE=HIDDEN NAME=name VALUE=value>

The hidden type input tag specifies a hard coded name-value pair within the form. This field is not displayed to the user. Both NAME and VALUE are required attributes.

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.

CDI Home Page

Form Input Image


<INPUT TYPE=IMAGE NAME=name SRC="URL">
(HTML 3.2 Only) <INPUT TYPE=IMAGE NAME=name SRC="URL" ALIGN="alignment">

The image type input tag specifies an image to be presented to the user. As soon as the user clicks on the image, the form is submitted with the selected x y coordinates of the spot on the image and the data for the other form fields. The NAME attribute is a required field and is used to identify the data for the field. The SRC and ALIGN attributes are the same as in the Inline Image tag.

(HTML 3.2 Only) The ALIGN attribute is used for image alignment and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.

(HTML 3.0 Only)The 3.0 specification added two new attributes: DISABLED, and ERROR. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field.

CDI Home Page

Form Input Password


<INPUT TYPE=PASSWORD NAME=name>
<INPUT TYPE=PASSWORD NAME=
name MAXLENGTH=length>
<INPUT TYPE=PASSWORD NAME=
name SIZE=size>
<INPUT TYPE=PASSWORD NAME=
name VALUE=value>

The password type input tag specifies a single line text entry field within the form that contains it. The value entered by the user will be obscured as it is entered. The NAME attribute is a required field and is used to identify the data for the field. The MAXLENGTH attribute specifies the number of characters that can be entered into this field. If MAXLENGTH is not specified then there is no limit on the number of characters entered. If MAXLENGTH is longer than SIZE then the text field will scroll appropriately. The SIZE attribute specifies the amount of display space this field should take up. The default for SIZE will vary by browser. The VALUE attribute specifies the initial value of the field.

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT..

CDI Home Page

Form Input Radio Button


<INPUT TYPE=RADIO NAME=name VALUE=value>
<INPUT TYPE=RADIO NAME=
name VALUE=value CHECKED>

The radio button type input tag allows a choice among a number of options. Normally more than one radio button will appear in the form with the same name. The user can then select only one of the of the choices. The NAME attribute is a required field and is used to identify the data for the field. If one of the choices has the CHECKED attribute it will initially be selected. If none of the choices has the CHECKED attribute then the first one defaults as initially selected. The VALUE attribute specifies the value that is returned if the box is checked.

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.

CDI Home Page

Form Input Range
Support: HTML:3.0 Netscape:No Support MS Explorer:No Support


<INPUT TYPE=RANGE NAME=name MIN=min MAX=max>
<INPUT TYPE=RANGE NAME=
name MIN=min> MAX=max VALUE=value>

The range type input tag allows the user to enter an number restricted to a set range. The NAME attribute is a required field and is used to identify the data for the field. The MIN and MAX attributes specify the minimum and maximum values that can be entered. If either MIN or MAX is a real number then the user can enter real numbers, otherwise only integers can be entered. The VALUE attribute specifies an initial value and should be in the range specified.

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.

CDI Home Page

Form Input Reset


<INPUT TYPE=RESET>

The reset type input tag specifies a button. When the user clicks the button, all the fields in the form are reset to their initial values.

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.

CDI Home Page

Form Input Scribble
Support: HTML:3.0 Netscape:No Support MS Explorer:No Support


<INPUT TYPE=SCRIBBLE NAME=name SRC=URL VALUE=text>

The scribble type input tag allows the user draw on a predefined image. The NAME attribute is a required field and is used to identify the data for the field. The SRC attribute specifies the URL of the image. The VALUE attribute specifies a text string that is used as an alternate if images or scribbling are not supported by the browser.

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.

CDI Home Page

Form Input Submit


<INPUT TYPE=SUBMIT>
<INPUT TYPE=SUBMIT NAME=
name>
<INPUT TYPE=SUBMIT VALUE=
value>

The submit type input tag specifies a button. When the user clicks the button, the form is submitted. The NAME attribute is used to identify the data for the field. If no NAME attribute is given then this element does not form part of the submitted response. The VALUE attribute specifies the label for the button.

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.

CDI Home Page

Form Input Text


<INPUT TYPE=TEXT NAME=name>
<INPUT TYPE=TEXT NAME=
name MAXLENGTH=length>
<INPUT TYPE=TEXT NAME=
name SIZE=size>
<INPUT TYPE=TEXT NAME=
name VALUE=value>

The text type input tag specifies a single line text entry field within the form that contains it. The NAME attribute is a required field and is used to identify the data for the field. The MAXLENGTH attribute specifies the number of characters that can be entered into this field. If MAXLENGTH is not specified then there is no limit on the number of characters entered. If MAXLENGTH is longer than SIZE then the text field will scroll appropriately. The SIZE attribute specifies the amount of display space this field should take up. The default for SIZE will vary by browser. The VALUE attribute specifies the initial value of the field.

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.

CDI Home Page

Form Select


<SELECT NAME=name> option entries </SELECT>
<SELECT NAME=
name MULTIPLE> option entries </SELECT>
<SELECT NAME=
name SIZE=size> option entries </SELECT>
(HTML 3.0 Only)<SELECT NAME=
name SRC=URL WIDTH=width HEIGHT=height UNITS=units> option entries </SELECT>
<OPTION>
content
<OPTION SELECTED>
content
<OPTION VALUE=
value> content
(HTML 3.0 Only)<OPTION SHAPE=
shape>

The select tag specifies a multiple line selection box field within the form that contains it. The user can select one or more lines if the attribute MULTIPLE is specified. The NAME attribute is a required field and is used to identify the data for the field. The SIZE attribute specifies the number of lines of selections that are to be displayed.
The SELECTED attribute of the option tag specifies that the option is to be initially selected. The VALUE attribute specifies the value to be returned if this option is selected. If the VALUE attribute is not specified the content of the option is used.

(HTML 3.0 Only)The select tag's SRC, WIDTH, HEIGHT, and UNITS attributes and the option tag's SHAPE attribute define an image map. These attributes are the same as the ones described in the Figure tag.

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.

CDI Home Page

Form Text Area


<TEXTAREA NAME=name COLS=# columns ROWS=# rows> content </TEXTAREA>
<TEXTAREA NAME=
name COLS=# columns ROWS=# rows WRAP=type> content </TEXTAREA>

 

The text area tag specifies a multiple line text area field within the form that contains it. The NAME attribute is a required field and is used to identify the data for the field. The COLS attribute specifies the width in characters of the text area. The ROWS attribute specifies the number of lines the text area contains. The content is used as an initial value for the field. The field can be scrolled beyond the COLS and ROWS size to allow for larger amounts of text to be entered. The wrap attribute can have values of OFF, SOFT and HARD.

(HTML 3.0 Only)The 3.0 specification adds three new attributes: DISABLED, ERROR, and ALIGN. The DISABLED attribute shows the field but will not allow the user to modify it. The ERROR attribute is used to supply an error message for the field. The ALIGN attribute is used to position the field and can be one of TOP, BOTTOM, MIDDLE, LEFT or RIGHT.