Available in Chrome 40+ | View on GitHub | Browse Samples
This sample illustrates the use of
reportValidity()
,
which provides a way to trigger <form>
validation logic.
If any of a <form>
's inputs are considered invalid, the offending inputs and the constraints
that are imposed will be identified in the user interface.
Additionally, reportValidity()
returns a boolean value indicating whether all of the inputs
in the <form>
were valid or not.
In this particular case, the <form>
contains one <input>
,
with two constraints: required
, as well as
minlength="4"
.