HTML Input Form

HTML Tutorial

HTML Basics

HTML Forms

HTML Graphics

HTML Media

HTML API

HTML Input Form * Attributes

The form Attribute

The input form attribute defines the form the <input> element belongs to.

The value of this attribute should be equal to the id attribute of the <form> element it belongs to.

Example

				
					<form action="/action_page.php" id="form1">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <input type="submit" value="Submit">
</form>

				
			

The formaction Attribute

The input formaction attribute defines the URL of the file that processes the input while submitting the form.

The formaction attribute is used with the following input types: submit and image.

Example

				
					  <input type="submit" formaction="/action_page2.php" value="Submit as Admin">
				
			

The formmethod Attribute

The input formmethod attribute specifies the HTTP method for sending form-data to the action URL.

The formmethod attribute is used with the following input types: submit and image.

The form-data is sent as URL variables (method=”get”) or as an HTTP post transaction (method=”post”).

Notes on the “get” method:

  • This method is used to append the form-data to the URL in name/value pairs.
  • This method is used for form submissions where a user bookmarks the result.
  • The “get” method should not be used to pass sensitive information.

Notes on the “post” method:

  • This method is used for sending the form-data as an HTTP post transaction.
  • Form submissions with the “post” method cannot be bookmarked.
  • The “post” method is secure as compared to “get”, and “post.” does not have size limitations.
				
					  <input type="submit" formmethod="post" value="Submit using POST">
				
			

The formtarget Attribute

The input formtarget attribute defines a name or a keyword, which points  where to display the response that is received after submitting the form.

The formtarget attribute is used with the following input types: submit and image.

Example

				
					  <input type="submit" formtarget="_blank" value="Submit to a new window/tab">
				
			

The formnovalidate Attribute

The input formnovalidate attribute defines an <input> element that cannot be validated while submitting the form.

The formnovalidate attribute is used with the following input types: submit.

Example

				
					<input type="submit" formnovalidate="formnovalidate" value="Submit without validation">
				
			

The novalidate Attribute

The novalidate attribute is a <form> attribute and defines all of the form-data should not be validated when submitted.

Example

				
					<form action="/action_page.php" novalidate>