forked from ngarneau/CoffeeScript-form-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
36 lines (28 loc) · 1.2 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
This is a very easy to use client side validation written in CoffeeScript / jQuery.
125 lines of coffee (including comments, spacing and everything, for a better look)
158 lines of javascript, uncompressed, 5,6kb
1 line of javsscript, compressed, 3,9kb
Please, if you have any suggestion, comment, advice, don't hesitate to post or add your lines into this code. Please update the Coffee file, not the JS one.
Actually, it does validates:
- Text inputs, checks for empty fields
- Email
- Postal Code (Canada)
- Number inputs
- Selects (checks if the first one is selected)
It is really simple, check the example form provided to see what exactly is under the hood.
All you got to do is add a class name "validate" for the fields you want to validate, and another class name that specifies the type of validation.
Be sure that your form as the "validate-form" class.
types are;
- text
- email
- code (postal code)
- number
- select
Be sure to add you error messages in the head section of your page, just like in the example, specifying them by ids within an associative array.
-----------------------
Programming Path
-----------------------
- CAN/US Validation
- Password Validation
- Radio Buttons
- Checkboxes