You can create different options in a variable an assign it to
$.validate().

var option1 = {
    rules: { ... }
    messages: { ... }
}

var option2 = {
    rules: { ... }
    messages: { ... }
}

Call the appropriate one depending on which step you're in:
$("#saverForm").validate(option1);
$("#saverForm").validate(option2);


On Sep 28, 5:38 am, adexcube <alfonsoenci...@gmail.com> wrote:
> Hi, I'm creating a step by step form using jquery ui tabs and
> validation plugin, the problem is that I've got just one form ( and I
> have to ) so on first step the form is validated but all errors an
> others steps are displayed.
> I'm using an approach ofhttp://jquery.bassistance.de/validate/demo/multipart/
> but I've got specific messages and validations.
>
> Something like
>
> var v=$("#saverForm").validate(
>         {
>                 debug: true,
>                 focusCleanup : false,
>
>                 rules: {
>                                 "signupDetails.hasUnderstoodDeclaration" : 
> "required",
>                                 applicantType: "required",
>                                 title: "required",},
>
>                 messages:{
>                                 "signupDetails.hasUnderstoodDeclaration" : 
> "Please accept The
> terms and conditions",
>                                 applicantType: "Please select an option.",
>                                 title:          "Please choose your title.",
>                                 firstname:      "Please enter your first 
> name.",
>                                 lastname:       "Please enter your surname.",
>
> });
>
> and a lot more fields.
>
> Is there any way I can add rules an messages to the form rather than
> add them to the fields??
>
> or can I create different form.validate() variables and then call them
> depending oin which step am I?
> something like
>
> v[0] =$("#saverForm").validate( ....some set of 2 rules for example )
> v[1] =$("#saverForm").validate( ....some set of 10 rules for example
> different than above)
>
> Many thanks

Reply via email to