<form> (Form for User Input)
The element defines a fill-in form to contain labels and form controls, such as menus and text entry boxes that might be filled in by a user.
accept-charset="list of supported character sets"</form>
dir="ltr | rtl"
enctype="application/x-www-form-urlencoded | multipart/form-data | text/plain | Media Type as per RFC 2045"
id="unique alphanumeric identifier"
method="GET | POST"
target="_blank | frame name | _parent | _self | _top" (transitional)
Attributes Defined by Internet Explorer
autocomplete="yes | no" (5.0)
contenteditable="false | true | inherit" (5.5)
disabled="false | true" (5.5)
hidefocus="true | false" (5.5)
unselectable="on | off" (5.5)
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup, onreset, onsubmit
Events Defined by Internet Explorer
onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresizeend, onresizestart, onselectstart, ontimeerror
Element Specific Attributes
- This attribute specifies the list of character encodings for input data that must be accepted by the server processing form. The value is a space- or comma-delimited list of character sets as defined in RFC 2045. The default value for this attribute is the reserved value unknown.
- This attribute contains the URL of the server program, which will process the contents of the form. Some browsers also might support a mailto URL, which can mail the results to the specified address.
- This Microsoft proprietary attribute, introduced in Internet Explorer 5.0, will automatically finish filling in information that the user has previously input into an input field, and which has been encrypted and stored by the browser.
- This attribute indicates how form data should be encoded before being sent to the server. The default is application/x-www-form-urlencoded. This encoding replaces blank characters in the data with a + and all other nonprinting characters with a % followed by the character's ASCII HEX representation. The multipart/form-data option does not perform character conversion and transfers the information as a compound MIME document. This must be used when using <input-type="file">. It also might be possible to use another encoding such as text/plain to avoid any form of hex encoding which might be useful with mailed forms.
- This attribute indicates how form information should be transferred to the server. The get option appends data to the URL specified by the action attribute. This approach gives the best performance, but imposes a size limitation determined by the command line length supported by the server. The post option transfers data using a HTTP post transaction. This approach is more secure and imposes no data size limitation.
- This attribute specifies a name for the form and can be used by client-side programs to reference form data.
- In documents containing frames, this attribute specifies the target frame to display the results of a form submission. In addition to named frames, several special values exist. The _blank value indicates a new window. The _parent value indicates the parent frame set containing the source link. The _self value indicates the frame containing the source link. The _top value indicates the full browser window.
method="POST" name="testform" onsubmit="validate()">
Enter your comments here:<br>
<textarea name="comments" cols="30" rows="8"></textarea>
HTML 2, 3.2, 4, 4.01, XHTML 1.0, 1.1, Basic
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4- 4.7, 6, 7
Form content is defined using the <button>, <input>, <select>, and <textarea> tags, as well as other HTML formatting and structuring elements.
Special grouping elements, such as fieldset, label, and legend are provided to structure form fields, but more often tags like <div> and <table> are used to improve form layout.
HTML 2 and 3.2 support only the action, enctype, and method attributes for the form element.