HTMLFormElement.reportValidity()

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

Boolean

Example

document.forms['myform'].addEventListener('submit', function() {
  document.forms['myform'].reportValidity();
}, false);

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'HTMLFormElement.reportValidity()' in that specification.
Living Standard
HTML 5.1
The definition of 'HTMLFormElement.reportValidity()' in that specification.
Recommendation Initial definition

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
reportValidityChrome Full support 40Edge Full support 17Firefox Full support 49IE No support NoOpera Full support YesSafari Full support YesWebView Android Full support 40Chrome Android Full support 40Firefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 4.0

Legend

Full support
Full support
No support
No support