[This documentation is preliminary and is subject to change.]
Specifies the information to be submitted to a website or service.
![]() ![]() |
Standards information
- Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5
- HTML 4.01 Specification, Section 17.3
HTML information
| Closing Tag | required |
|---|---|
| CSS Display | block |
DOM Information
Inheritance Hierarchy
Remarks
Security Warning: Using this object incorrectly can compromise the security of your application. Data submitted through a form using the HTTP protocol is not encrypted and can be read and possibly tampered with in transmission. The Secure Hypertext Transfer Protocol (HTTPS) can provide more secure data transmission. You should review the Security Considerations: Dynamic HTML before continuing.
Forms enable client-side users to submit data to a server in a standardized format. The creator of a form designs it 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 form includes only one text box and the user presses ENTER, the onsubmit event fires. If the form has an input type=submit element, it will appear as a button with a dark border, which indicates the user can press ENTER to submit the form.
Windows Internet Explorer 8 and later. The value of the action attribute depends on the current document compatibility mode. In addition, the form object now supports enctype as a Document Object Model (DOM) attribute.
Examples
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 attribute. The value of the method attribute 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
Build date: 3/8/2012

