views:

938

answers:

2

Client side form validation becomes easiest by using jQuery.

I tried all validators and they are so simple!

But in date, number and range validators; I need to add two validators in sequence

1) Required 2) Date

so is it possible.

Another common requirement is to reset the Form Fiels. Is is possible using jQuery without writing too much code?

+1  A: 

You can add many rules at once.

As far as resetting the form, there is a method for this built into Javascript:

$('#myform')[0].reset();
Paolo Bergantino
Easiest way to add new rule is to write like class="date required"
Vikas
jQuery has also function called $("#myForm").resetForm()Which will also clean extra HTML code...
Vikas
A: 

Using two validators should not be an issue. Do you get an error?

Use the jQuery form plugin here : http://www.malsup.com/jquery/form/#api for reset functionality.

sandesh247
Recommending adding an entire plugin for a native DOM function? Questionable at best...
Paolo Bergantino
In my ASP.net page, the reset function wont work in Firefox. Not tested on any other browser though.
sandesh247
How are you calling it? I've tested it and it works fine on Firefox.
Paolo Bergantino