You are here: Reference > HTML > tags > form

form element

Browser support:
Creates a container element for controls.
The form element allows users to submit data to a server. The target URL can be specified with the action attribute. The method attribute defines the way of sending.
The contents of the message submitted to the server depend on the named form controls in the form tag. Named control means an element with a non-empty name attribute.
Only the contents or the state of the named form controls will be sent.
The following elements are form controls: When a form is submitted, the message contains the name/value pairs belonging to the named controls in the form. The name parameter is the value of the name attribute of the control. The contents of the value parameter depend on the type of the control.
Push buttons (button, input:button, input:reset, input:submit) don't play an important part in the message. If a push button is named and it is in pushed state when the form is submitted, then the name and the value (the value of the value attribute) of the button will be sent with the form. If a push button is not in pushed state, no information is sent with the form that belongs to the button. Since only one push button can be in pushed state at any time, they don't play an important part in the message.
The reset button can be used to reset all controls to their initial values within the form. The user can send the form to the server by clicking on the submit button.
The other controls are useful for the message submitted to the server.
If you want to see the HTML tags by categories, please visit this page.
This element requires a closing tag.
JavaScript page for this element: form.

Possible members:

Sets a comma-separated list of accepted content types.
Sets a list of character encodings for a form.
Sets an access key to an element.
Sets a form processing agent. With this attribute you can set an URL to call when the form is sent.
Sets whether the text field should give the user some suggestion during typing.
Sets the style class or classes that belong to the element.
Sets whether the contents of the object are editable.
Sets the text direction as related to the lang attribute.
Sets the state of an object for user interaction.
Sets whether an element is draggable.
Sets how form data should be encoded for submitting to the server.
Specifies whether a dotted rectangle (focus rectangle) is drawn around an object while it has focus.
Sets a unique identifier for the object.
Specifies the language of the element.
Sets the scripting language for the current element. Use it only for the script element.
Specifies how the data of a form should be submitted to the server. When the user clicks on the submit button of a form, the data of the named elements in the form will be sent. The data contains the name and the value of the named element.
Sets the name of an element.
Sets whether the automatic spellchecker is enabled.
Sets an inline style associated with an element.
Specifies the tabbing order for keyboard navigation using the TAB key.
Specifies the target window or frame where the document is to be opened.
Specifies a tooltip for an element.
Sets whether the selection process can start in an element's content.
Sets the language code of the XML document.

Example HTML code 1:

This example illustrates the use of the form element:
<form action="#URL#" method="post">
    User Name: <input type="text" name="userName" />
    <br />
    Password: <input type="password" name="password" />
    <br />
    <input type="reset" value="Reset" />
    <input type="submit" value="Sign in" />
Did you find this example helpful? yes no

Related pages:

External links:

User Contributed Comments

Post Content

Post Content