Form validation tool
npm install js-simple-validations - Validates as you type
- No dependency on any other library or framework (vanilla JS)
- Configures with HTML, using data attributes (write no JS, unless you want)
- No separate styling needed (unless you want to customize)
- Promise-based and debounced
- Supports async validations
- ES5-compatible, tested back to IE11
- Can be used for multiple forms on a page
- Only 10kb gzipped
JSV listens for input, change and focusout events on each field in the form, and the submit event on the form itself. Validations are triggered on each of those events. When all fields pass validation, the form is in a "valid" state and can be submitted.
To avoid you having to write any Javascript, JSV instantiates and attaches to form elements when the page is ready. JSV is intended for use with "traditional" server-side rendered HTML forms. So if you're using a framework or otherwise creating your forms with Javascript, it probably won't work.
Or install with npm:
npm install js-simple-validations --save-dev
Then import into your bundle with:
import SimpleValidations from 'js-simple-validations';
On your form(s) add this data-jsv-form="true" to any form(s) you want to validate: