rr-validation
v1.0.3
Published
A small, lightweight module to provide some validation to your forms.
Downloads
27
Readme
Reading Room Validation
A small, lightweight module to provide some validation to your forms.
Installation
$ npm install rr-validation
Basic Usage
import { EmailValidation, RequiredValidation, TelephoneValidation } from 'rr-validation';
new EmailValidation('.email-field');
new RequiredValidation('.required-field');
new TelephoneValidation('.telephone-field');
Ensure your form's labels follow correct HTML semantics and have the for
attribute which matches the id
of the input it corresponds to. This is needed to display validation error messages in real time as the form is filled in.
Disable Submit
<button type="submit" class="submit-button">Submit</button>
Create a submit button which has the class .submit-button
. The module will then disable the button if any of the validation rules have been broken within the form.