HTML 5 <form> Tag
Example
A simple HTML form with two input fields and one submit button:
<form action="form_action.asp">
First name:
<input type="text" name="fname" value="Mickey"
/><br />
Last name:<input type="text" name="lname" value="Mouse"
/><br />
<input type="submit" value="Submit" />
</form> |
Try it yourself »
|
Definition and Usage
The form element creates a form for user input.
The form element contains one or more form elements: button, input, keygen, object, output, select, and textarea.
Forms are used to pass user-data to a server.
Differences Between HTML 4.01 and HTML 5
HTML 5 has some new attributes, and some HTML 4.01 attributes are not supported in HTML 5.
Attributes
| Attribute |
Value |
Description |
| accept-charset |
charset_list |
A comma separated list of possible character sets for the
form data. |
| action |
URL |
A URL that defines where to send the data when the submit button
is pushed |
| autocomplete |
on off |
If "on" browsers can store the form's input values, to auto-fill the form if the user returns to the page.
If "off" browsers should not store this information. |
| enctype |
application/x-www-form-urlencoded
multipart/form-data
text/plain |
The mime type used to encode the content of the form |
| method |
get
post
put
delete |
The HTTP method for sending data to the action URL. Default
is get. method="get": This method sends the form contents
in the URL: URL?name=value&name=value. Note: If the form values contains non-ASCII characters or
exceeds 100
characters you MUST use method="post".
method="post": This method sends the form contents in the body of the request.
Note: Most browsers are
unable to bookmark post requests.
|
| name |
form_name |
Defines a unique name for the form. |
| novalidate |
novalidate |
If present the form should not be validated when submitted. |
| target |
_blank
_self
_parent
_top |
Where to open the target URL.
- _blank - the target URL will open in a new window
- _self - the target URL will open in the same frame as it was clicked
- _parent - the target URL will open in the parent frameset
- _top - the target URL will open in the full body of the window
|
Standard Attributes
| class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title |
For a full description, go to Standard Attributes in HTML 5.
Event Attributes
| onabort, onbeforeunload, onblur, onchange, onclick,
oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave,
ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress,
onkeyup, onload, onmessage, onmousedown, onmousemove,
onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect,
onsubmit, onunload |
For a full description, go to Event Attributes in HTML 5.
Make your web applications look like a million bucks
|
|
Most web applications today use boring methods to present data to their viewers using grids or simple HTML tables. FusionCharts induces "life" into the web applications by converting monotonous data into lively charts, gauges & maps.
FusionCharts works with all technologies like ASP, ASP.NET, PHP, ColdFusion, Ruby on Rails, JSP, HTML pages etc.
and connects to any database to render animated & interactive charts. It takes less than 15 minutes and no expertise
whatsoever to build your first chart and just a glance of it to captivate your audience. This fact is endorsed by our
12,000 customers and 150,000 users which include a majority of the Fortune 500 companies.
And yeah, your applications could look like a million bucks by spending just $69.
So go ahead, download your
copy of FusionCharts and start "wow-ing" your customers now!
|
 |
W3Schools' Online Certification Program
The perfect solution for professionals who need to balance work, family, and career building.
More than 4000 certificates already issued!
|
The HTML Certificate documents your knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
|