formnovalidate

The formnovalidate attribute allows form submission without triggering validation checks when used with <button> or <input type="submit">, bypassing the default validation rules.

formnovalidate attribute

The formnovalidate attribute is a boolean attribute in HTML that allows form submission to skip validation checks. It can be used with <button> and <input type="submit"> elements. When set, it ensures the form is submitted without enforcing standard validation rules, such as those set by the required or pattern attributes.

Syntax

index.html
<tagname type="submit" formnovalidate>

Example

Here’s an example of using the formnovalidate attribute:

index.html
<form>
  <input type="text" name="username" required placeholder="Username">
  <input type="password" name="password" required placeholder="Password">
  <button type="submit">Submit</button>
  <button type="submit" formnovalidate>Submit Without Validation</button>
</form>
  • In this example, the first button will trigger validation, while the second button, which has the formnovalidate attribute, will submit the form without validating the input fields.
The formnovalidate attribute can be applied to elements with type="submit".

Values

The formnovalidate attribute is a boolean attribute, which means it doesn't require any associated values.

Applies To

The formnovalidate attribute can be applied to the following HTML elements.

Example







index.html
<form novalidate>
  <label for="name">Name:</label><br>
  <input type="text" id="name" name="name" required>
  <br><br>
  <label for="email">Email:</label><br>
  <input type="email" id="email" name="email" required>
  <br><br>
  <input type="submit" value="Submit">
</form>

Conclusion

The formnovalidate attribute allows skipping form validation when submitting with a button or input element. It is particularly useful for scenarios where you need to bypass validation checks temporarily. This attribute can be applied to <button> or <input type="submit"> elements to control form submission behavior.