Validation
Practical patterns for thoughtful interfaces.
Primary example
More possibilities
Helpful feedback
Submit an empty form to reveal the invalid fields. Enter a valid email and a password of at least eight characters to see the success state.
The form uses HTML constraints and Bootstrap validation styles.
Usage
form.classList.add('was-validated');
if (form.checkValidity()) { /* process valid data */ }