This wiki has been archived and is now read-only.


From HTML Wiki
Jump to: navigation, search


The form element represents a user-submittable form.


  • Some of which can represent editable values that can be submitted to a server for processing.

HTML Attributes

  • accept-charset = list of character-encoding names
    gives the character encodings that are to be used for the submission.

  • action = valid URL potentially surrounded by spaces
    Specify the form-submission action for the element.

  • autocomplete = on/ off
    Specifies whether the element represents a form for which by default a UA is meant to store the values entered into its input elements by the user (so that the UA can pre-fill the form later).
    • on
      The on state indicates that the value is not particularly sensitive and the user can expect to be able to rely on his user agent to remember values he has entered for that control.
    • off
      The off state indicates either that the control's input data is particularly sensitive (for example the activation code for a nuclear weapon); or that it is a value that will never be reused (for example a one-time-key for a bank login) and the user will therefore have to explicitly enter the data each time, instead of being able to rely on the UA to prefill the value for him; or that the document provides its own autocomplete mechanism and does not want the user agent to provide autocompletion values.

  • enctype = application/x-www-form-urlencoded / multipart/form-data / text/plain
    Specfy a MIME type with which a UA is meant to associate this element for form submission.
    The missing value default for these attributes is the application/x-www-form-urlencoded state.
    • application/x-www-form-urlencoded
    • multipart/form-data
    • text/plain

  • method = get/ post
    Specify the HTTP method with which a UA is meant to associate this element for form submission.
    The missing value default for this attributes is the GET state.
    • get
      Indicating the HTTP GET method.
    • post
      Indicating the HTTP POST method.

  • name = string
    Gives the name of the input element.

  • novalidate = boolean
    If present, they indicate that the form is not to be validated during submission.

  • target = valid browsing context names or keywords
    Specfy a browsing context name or keyword that represents the target of the control.


Example A

[try it]

<form action="http://www.google.com/search" method="get">
  <label>Google: <input type="search" name="q"></label>
  <input type="submit" value="Search...">

HTML Reference

The HTML5 specification defines the <form> element in 4.10.1 The form element.