Internet Explorer HTML Specification Tool Bar

Forms


This following information is described here:




HTML Features Which Produce Forms


FORM

Denotes a form.

Attribute Explanation Example Source
ACTION="URL" Specifies the address to be used to carry out the action of the form. If none is specified, the base URL of the document is used. <FORM ACTION="http:// www.sample.com/bin/search"> … </FORM> HTML 2
METHOD=GET or POST Indicates how the form data should be sent to the server. GET means append the arguments to the action URL and open it as if it were an anchor; POST means send the data via an HTTP post transaction. <FORM ACTION="http:// www.sample.com/bin/search" METHOD=GET> … </FORM> HTML 2



INPUT

Specifies a form control.

Attribute Explanation Example Source
ALIGN=TOP, MIDDLE, or BOTTOM Used when TYPE=IMAGE. Specifies how the next line of text will be aligned with the image. <INPUT NAME="Control1" TYPE=IMAGE SRC="sample.gif" ALIGN=MIDDLE>This text is aligned with the middle of the preceding image. HTML 2
CHECKED=TRUE or FALSE For check boxes and radio buttons, indicates that they are selected. <INPUT NAME="Control2" TYPE=CHECKBOX CHECKED=TRUE> HTML 2
MAXLENGTH= "length" Indicates the maximum number of characters that can be entered into a text control. <INPUT NAME="Control3" TYPE=TEXTBOX MAXLENGTH=10> HTML 2
NAME="name" Specifies the name of the control. <INPUT NAME="Control4" TYPE=TEXTBOX MAXLENGTH=10> HTML 2
SIZE="size" SIZE="width, height" Specifies the size of the control (in characters). For TEXTAREA-type controls, both height and width can be specified. <INPUT NAME="Control5" TYPE=TEXTBOX SIZE=30><INPUT NAME="Control6" TYPE=TEXTAREA SIZE="30,5"> HTML 2
SRC="address" Used when TYPE=IMAGE. Specifies the address of the image to be used. <INPUT NAME="Control7" TYPE=IMAGE SRC="sample.gif" ALIGN=MIDDLE> HTML 2
TYPE Specifies what type of control to use. See Form Control Types below. <INPUT NAME="Control8" TYPE=CHECKBOX CHECKED=TRUE> HTML 2
VALUE For textual/numerical controls, specifies the default value of the control. For Boolean controls, specifies the value to be returned when the control is turned on. <INPUT NAME="Control9" TYPE=TEXTBOX VALUE="Your Name">
<INPUT NAME="Control10" TYPE=CHECKBOX VALUE=TRUE>
HTML 2




Form Control Types


TYPE

The following list, taken from the HTML 2.0 spec (5/6/95), represents all the valid types of controls for the TYPE attribute of the INPUT tag.

Control Explanation Example Source
CHECKBOX Used for simple Boolean attributes or for attributes that can take multiple values at the same time. It is represented by a number of check box fields, each of which has the same name. Each selected check box generates a separate name/value pair in the submitted data, even if this results in duplicate names. The default value for check boxes is "on." <INPUT TYPE="CHECKBOX" NAME="Control1" VALUE="FALSE"> HTML 2
HIDDEN No field is presented to the user, but the content of the field is sent with the submitted form. This value can be used to transmit state information about client/server interaction. <INPUT TYPE="HIDDEN" NAME="Control2"> HTML 2
IMAGE An image field which you can click, causing the form to be immediately submitted. The coordinates of the selected point are measured in pixel units from the upper-left corner of the image, and are returned (along with the other contents of the form) in two name/value pairs. The x-coordinate is submitted under the name of the field with ".x" appended, and the y-coordinate is submitted under the name of the field with ".y" appended. Any VALUE attribute is ignored. The image itself is specified by the SRC attribute, exactly as for the Image element. (20) <INPUT TYPE="IMAGE" NAME="CONTROL3" SRC="sample.gif" ALIGN=MIDDLE> HTML 2
PASSWORD The same as the TEXT attribute, except that text is not displayed as the user enters it. <INPUT TYPE="PASSWORD" NAME="CONTROL4"> HTML 2
RADIO Used for attributes that accept a single value from a set of alternatives. Each radio-button field in the group should be given the same name. Only the selected radio button in the group generates a name/value pair in the submitted data. Radio buttons require an explicit VALUE attribute. <INPUT TYPE="RADIO" NAME="CONTROL5" VALUE="0" CHECKED>
<INPUT TYPE="RADIO" NAME="CONTROL5" VALUE="1">
HTML 2
RESET A button that when clicked resets the form's fields to their specified initial values. The label to be displayed on the button can be specified just as for the SUBMIT button. <INPUT TYPE="RESET" VALUE="Reset"> HTML 2
SUBMIT A button that when clicked submits the form. You can use the VALUE attribute to provide a non-editable label to be displayed on the button. The default label is application-specific. If a SUBMIT button is clicked in order to submit the form, and that button has a NAME attribute specified, then that button contributes a name/value pair to the submitted data. Otherwise, a SUBMIT button makes no contribution to the submitted data. <INPUT TYPE="SUBMIT" VALUE="Send"> HTML 2
TEXT Used for a single-line text-entry field. Use in conjunction with the SIZE and MAXLENGTH attributes. <INPUT TYPE="TEXT" NAME="Control6" SIZE="20" MAXLENGTH="50"> HTML 2
TEXTAREA Used for multiple-line text-entry fields. Use in conjunction with the SIZE and MAXLENGTH attributes. <INPUT TYPE="TEXTAREA" NAME="Control7" SIZE="20,5" MAXLENGTH="250"> HTML 2




List Boxes Used in Forms


SELECT

Denotes a list box or dropdown list.

Attribute Explanation Example Source
none Specifies a list box or dropdown list. <SELECT NAME="Cars" MULTIPLE SIZE="1">
<OPTION VALUE="1">BMW
<OPTION VALUE="2">PORSCHE
<OPTION VALUE="3" SELECTED>MERCEDES</SELECT>
HTML 2
MULTIPLE Indicates that multiple items can be selected. See above. HTML 2
NAME Specifies a name for the list. See above. HTML 2
SIZE Specifies the height of the list control. See above. HTML 2



OPTION

Denotes one choice in a list box.

Attribute Explanation Example Source
none In a <SELECT> block, denotes one of the choices that will appear in the list. <SELECT NAME="Cars" MULTIPLE SIZE="1">
<OPTION VALUE="1">BMW
<OPTION VALUE="2">PORSCHE
<OPTION VALUE="3" SELECTED>MERCEDES</SELECT>
HTML 2
SELECTED Indicates that this item is the default. If not present, item #1 becomes the default. See above. HTML 2
VALUE Indicates the value that will be returned if this item is chosen. See above. HTML 2


Best Viewed with Internet Explorer

Back to: HTML Specification Home Page

© 1996 Microsoft Corporation