PristineJS is a vanilla javascript form validation micro-library.
It has sensible default behavior, and we can easily style Pristine messages
by specifying CSS rules for the classes has-success
, has-danger
, and text-help
A key point to using Pristine is to include the form-group
class on the element that any Pristine messages will be appended.
For everything but radio and checkbox inputs, the label
element works well for this. For radio and checkbox, the fieldset
that
contains the radio or checkbox group is a good choice.
input
. In the JS, we select the elements with that attribute/value and set the validation logic.Validate.js provides a declarative way of validating javascript objects. The bulk of the work needs to be on the implementor side of things (that's us) for HTML forms, but validate.js does provide a good library of core validation functions.