The HTMLFormElement.reportValidity()
method returns true
if the element's child controls satisfy their validation constraints. When false
is returned, cancelable invalid
events are fired for each invalid child and validation problems are reported to the user.
Syntax
HTMLFormElement.reportValidity()
Return value
Example
document.forms['myform'].addEventListener('submit', function() {
document.forms['myform'].reportValidity();
}, false);
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living StandardThe definition of 'HTMLFormElement.reportValidity()' in that specification. | Living Standard | |
HTML 5.1The definition of 'HTMLFormElement.reportValidity()' in that specification. | Recommendation | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
reportValidity
|
Chrome
Full support 40 |
Edge
Full support 17 |
Firefox
Full support 49 |
IE
No support No |
Opera
Full support Yes |
Safari
Full support Yes |
WebView Android
Full support 40 |
Chrome Android
Full support 40 |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support 4.0 |
Legend
- Full support
- Full support
- No support
- No support
HTMLFormElement.reportValidity() by Mozilla Contributors is licensed under CC-BY-SA 2.5.