HTML Form Attributes

HTML5 Form Attributes This article describes the different attributes for the <form> tag.

  • The Action Attribute

    The action attribute defines the action to be performed when the form is submitted.
    Usually, the form data is sent to a file on the server when the user clicks on the submit button.
  • The target attribute

    The target attribute specifies where to display the response that is received after submitting the form.
    The target attribute can have one of the following values:
    1. _blank The response is displayed in a new window or tab
    2. _self The response is displayed in the current window
    3. _parent The response is displayed in the parent frame
    4. _top The response is displayed in the full body of the window
    5. framename The response is displayed in a named iframe
  • The method attribute specifies the HTTP method to be used when submitting the form data.

    The form-data can be sent as URL variables (with method="get") or as HTTP post transaction (with method="post").
    The default HTTP method when submitting form data is GET.
  • The autocomplete atttribute

    If it is "on", the form fields will gain suggestions in a dropdown box as you type characters in a text field. Example:
    <form action="/action_page.php" autocomplete="on">
  • The novalidate attribute is a boolean attribute.


    When present, it specifies that the form-data (input) should not be validated when submitted
    Example:
    <form action="/action_page.php" novalidate>
  • The enctype attribute specifies how the form-data should be encoded when submitting it to the server.

    Note: The enctype attribute can be used only if method="post"
    If enctype is "application/x-www-form-urlencoded", characters are encoded before sent (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values)
    "multipart/form-data" attribute value is necessary if the user will upload a file through the form

Comments

Popular posts from this blog

Parallel Database design, query processing

Laravel | PHP | Basics | Part 2

Apache Hadoop | Running MapReduce Jobs