web api instance method
HTMLFormElement: reportValidity() method
The reportValidity() method of the HTMLFormElement interface performs the same validity checking steps as the checkValidity() method. In addition, for each invalid event that was fired and not canceled, the browser displays the problem to the user.
Syntax
reportValidity()
Parameters
None.
Return value
Returns true if the associated controls’ values have no validity problems; otherwise, returns false.
Example
document.forms["my-form"].addEventListener("submit", () => {
document.forms["my-form"].reportValidity();
});
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.