The Easiest Form Validation - JQuery Validation

I tried to use JQuery Validation. That is the easiest form validation library!!!!!
I just need to include the jquery library and its js file. Then I add these code in $(document).ready
Code
| $([form element]).validate({rules: { | |
|    [field name]: { | |
|       [built-in Validation methods] | |
| ... | |
|     } | |
|   } | |
| }); | 
This is the validation rule.
I think that is easier to explain in an example.
I got a form like this:
Code
| <form id="frm" method="POST"> | |
| Name : <input type="text" id="name" name="name" /> <br/> | |
| Email: <input type="text" id="email" name="email" /> | |
| <input type="submit" id="submit" value="Submit"/> | |
| </form> | 
Then I just need add those code in $(document).ready
Code
| $("#frm").validate({rules: { | |
|    email: { | |
|       required: true, | |
|       email: true | |
|     }, | |
|   name: "required" | |
|   } | |
| }); | 
Then the form will be validated when the user submits the data.
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
Feedback awaiting moderation
This post has 9 feedbacks awaiting moderation...
Form is loading...
