HTML input Tag formnovalidate Attribute Tutorial

In this section, we will learn what formnovalidate attribute is and how to use it.

What is formnovalidate Attribute in HTML <input> Tag?

In the required attribute section, we mentioned that if this attribute is used in an input field, that field needs to be filled with the related data. If we don’t do that, the form won’t be submitted.

This is part of auto validation of data in a form that is done by the browsers.

But sometimes for whatever reason we might not want to validate a form but send the data, whatever it is, directly to a server.

This is where we can use the formnovalidate attribute.

The formnovalidate attribute is used in <input> elements of type “image” or “submit” and when used, the form won’t be validated when that submit button is clicked. Basically, the data will be sent to a server directly without any sort of validation applied to it.

HTML formnovalidate Attribute in <input> Tag Syntax:

<input type = “image | submit” formnovalidate>

<input> Tag formnovalidate Attribute Values

We only use the formnovalidate attribute in the target input element. It doesn’t need any value.

Example: using formnovalidate attribute in HTML <input> tag

See the Pen using formnovalidate attribute in HTML <input> tag by Omid Dehghan (@odehghan) on CodePen.

In this example, even though all three input elements are set to required (which means the fields need to be filled with data) the form still can be submitted to a server because of the formnovalidate attribute set for the submit button.


Top Technologies