HTML Form Attributes


This chapter describes the different attributes for the HTML <form> element.


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 called "action_page.php". This file contains a server-side script that handles the form data:

Tip: If the action attribute is omitted, the action is set to the current page.


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:

The default value is _self which means that the response will open in the current window.


The Method Attribute

The method attribute specifies the HTTP method that should 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.

Notes on GET:

Notes on POST:


The Autocomplete Attribute

The autocomplete attribute specifies whether a form should have autocomplete on or off.

When autocomplete is on, the browser automatically complete values based on values that the user has entered before.


The Novalidate Attribute

The novalidate attribute is a boolean attribute.

When present, it specifies that the form-data (input) should not be validated when the form is submitted.