Specifies that the contained controls take part in a form.
HTML Syntax
<FORM ACTION=url CLASS=classname ENCTYPE=encoding ID=value LANG=language LANGUAGE=JAVASCRIPT | JSCRIPT | VBSCRIPT | VBS METHOD=GET | POST NAME=name STYLE=css1-properties TARGET=window_name | _blank | _parent | _search | _self | _top TITLE=text event = script >
Remarks
Forms enable client-side users to submit data to a server in a standardized format. The creator of a form designs the form to collect the required data using a variety of controls, such as INPUT or SELECT. Users viewing the form fill in the data and then click the Submit button to send the data to the server. A script on the server then processes the data.
Each control element's NAME attribute must be defined if the data is to be submitted with the form. An element in a form can be referenced by the NAME property or the ID property, or through the elements collection.
When the focus is on a control in a form and the user presses ESC, the value of the control reverts to the last value. The form resets if the user presses ESC again. If the focus is on the form but not on a particular control and the user presses ESC once, the form resets.
If the form includes only one text box and the user presses ENTER, the onsubmit event fires. If the form has a Submit button, the button has a dark border, which indicates the user can press ENTER to submit the form.
The FORM element is a block element and requires a closing tag.
This element is available in HTML and script as of Microsoft® Internet Explorer 3.0.
Members
Styles
Example
This example uses the FORM element to create a basic form containing a text entry box for the user's name and a select control for choosing a favorite ice cream flavor. When the user clicks the Submit button, the form sends the data to the URL listed in the ACTION property. The value of the METHOD property determines how to send the data to the server.
<HTML> <FORM ACTION="http://example.microsoft.com/sample.asp" METHOD="POST"> Enter your name: <INPUT NAME="FName"><BR> Favorite Ice Cream Flavor: <SELECT NAME="Flavor"> <OPTION VALUE="Chocolate">Chocolate <OPTION VALUE="Strawberry">Strawberry <OPTION VALUE="Vanilla" SELECTED>Vanilla </SELECT> <P><INPUT TYPE=SUBMIT> </FORM> </HTML>
See Also