Quackit Logo

FREE Hosting!

With every domain name you register with ZappyHost, you get FREE hosting.

$1.99 Domain Names

With every new non-domain purchase thru ZappyHost, you get a domain name for only $1.99.

HTML form Tag

Print Version

The information on this page is based on HTML version 4.01 (which is the current version of HTML). The next version, HTML 5, is currently being written. Here's a list of HTML 5 tags.

The HTML form tag is used for declaring a form.

The <form> tag is used in conjunction with form-associated elements. To create a form, you can nest form-associated elements inside the opening/closing <form> tags.

Form-Associated Elements

Here are the elements that you can use with your forms.

These elements allow the user to provide information to the website - information which can be submitted to the server for processing.

HTML 5 gives forms the ability to have improved functionality. For example, a form element can contain the form attribute to bind itself to a form. HTML 5 also introduces the <datalist> element. For more information, see the HTML 5 <form> element.

Example
<form action="/html/tags/html_form_tag_action.cfm" method="get">
First name:
<input type="text" name="first_name" value="" maxlength="100" />
<br />
Last name:
<input type="text" name="last_name" value="" maxlength="100" />
<input type="submit" value="Submit" />
</form>

The above code produces the following form:

First name:
Last name:
Attributes:
Attributes specific to this tag:
AttributeDescription
actionSpecifies a URI/URL of the page that will process the form.
methodSpecifies the HTTP method to use when the form is submitted. Possible values:
  • get (the form data is appended to the URL when submitted)
  • post (the form data is not appended to the URL)
enctypeSpecifies the content type used to encode the form data set when it's submitted to the server. Possible values:
  • application/x-www-form-urlencoded (default)
  • multipart/form-data (use this when uploading files)
accept-charsetSpecifies a list of character encodings that the server accepts. The default value is "UNKNOWN".
acceptSpecifies a comma-separated list of content types that the server accepts.
nameAssigns a name to the form. This is used when referencing the form with stylesheets or scripts. If there are multiple forms, the name of each form must be unique.
Other Attributes:
AttributeDescription
classDocument wide identifier.
idDocument wide identifier
dirSpecifies the direction of the text
langLanguage code
targetSpecifies the target frame to load the destination page as indicated with the action attribute.
onSubmitIntrinsic event (see event handlers)
onResetIntrinsic event (see event handlers)
onclickIntrinsic event (see event handlers)
ondbclickIntrinsic event (see event handlers)
onmousedownIntrinsic event (see event handlers)
onmouseupIntrinsic event (see event handlers)
onmouseoverIntrinsic event (see event handlers)
onmousemoveIntrinsic event (see event handlers)
onmouseoutIntrinsic event (see event handlers)
onkeypressIntrinsic event (see event handlers)
onkeydownIntrinsic event (see event handlers)
onkeyupIntrinsic event (see event handlers)

Also see the HTML 5 version of HTML tags

Enjoy this website?

  1. Link to this page (copy/paste into your own website or blog):
  2. Add this page to your favorite social bookmarks sites:
               
  3. Add this page to your Favorites

Oh, and thank you for supporting Quackit!