Javascript DOM HTML Input Submit formNoValidate Property get

Introduction

Find out if the form-data should be validated or not:

var x = document.getElementById("mySubmit").formNoValidate;

Click the button to find out if the form-data should be validated or not, when submitted.

View in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php" method="get">
  E-mail: <input type="email" name="userid"><br>
  <input type="submit" id="mySubmit" value="Submit" formnovalidate>
</form>//from ww  w.j a v  a2 s  . c o  m
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
  var x = document.getElementById("mySubmit").formNoValidate;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The formNoValidate property sets or gets whether the form-data should be validated or not, when submitted.

This property mirrors the formnovalidate attribute.

When set to true, this property adds the "formnovalidate" attribute to the submit button.

It sets that the form-data should not be validated when submitted.

This overrides the form's novalidate attribute.

Value Description
true The form-data should not be validated
false Default. The form-data should be validated

The formNoValidate property returns true if the form-data should not be validated, otherwise it returns false.




PreviousNext

Related