Javascript Reference - HTML DOM Input Submit formNoValidate Property








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

Browser Support

formNoValidate Yes 10.0 Yes Yes Yes

Syntax

Return the formNoValidate property.

var v = submitObject.formNoValidate

Set the formNoValidate property.

submitObject.formNoValidate=true|false

Property Values

Value Description
true|false Set whether the form-data should be validated when submitted
  • true - The form data should not be validated
  • false - Default. The form data should be validated




Return Value

A Boolean type value, true if the form-data should not be validated, otherwise false.

Example

The following code shows how to set the formNoValidate property.


<!DOCTYPE html>
<html>
<body>
<!--   w  w w  .  ja  v  a  2 s . co  m-->
<form action="demo_form.asp" method="get">
  E-mail: <input type="email" name="userid"><br>
  <input type="submit" id="mySubmit" value="Submit" formnovalidate>
</form>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {
  document.getElementById("mySubmit").formNoValidate = false;
}
</script>

</body>
</html>

The code above is rendered as follows:





Example 2

The following code shows how to get if the form-data should be validated or not.


<!DOCTYPE html>
<html>
<body>
<!-- w  w  w .j ava2s .c o  m-->
<form action="demo_form.asp" method="get">
  E-mail: <input type="email" name="userid"><br>
  <input type="submit" id="mySubmit" value="Submit" formnovalidate>
</form>
<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 code above is rendered as follows: