The noValidate
property turns off or on
the form validation on submission.
noValidate |
Yes | 10.0 | Yes | Yes | Yes |
Return the noValidate property.
var v = formObject.noValidate
Set the noValidate property.
formObject.noValidate=true|false
Value | Description |
---|---|
true|false | Turn on or off form-data validation on submission
|
A Boolean type value, true if the form-data should not be validated, otherwise false.
The following code shows how to set the noValidate property.
<!DOCTYPE html>
<html>
<body>
<!-- w ww . j av a 2 s . c o m-->
<form id="myForm" action="url">
E-mail: <input type="email" name="user_email">
<input type="submit">
</form>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {
document.getElementById("myForm").noValidate = true;
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to get if the form-data should be validated.
<!DOCTYPE html>
<html>
<body>
<!--from w w w . jav a2 s. c om-->
<form id="myForm" action="url" novalidate>
E-mail: <input type="email" name="user_email">
<input type="submit">
</form>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myForm").noValidate;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: