Adnan
Adnan

Reputation: 1409

smartWizard and jQuery validate

I am using smartWizard (can be found here http://techlaboratory.net/smartwizard) and now want to validate the form using jQuery validate plugin (can be found here http://bassistance.de/jquery-plugins/jquery-plugin-validation/ or here http://jqueryvalidation.org/)

I tried

$('#wizard').smartWizard({
    onFinish: function() {
        $("form").validate();
    }
});

but no working !

I am using .validate() only because i passed the rules in HTML attributes!

Upvotes: 1

Views: 12243

Answers (2)

Dipu Raj
Dipu Raj

Reputation: 1884

Latest version (SmartWizard 4.x) have an implementation with jQuery validator plugin. Check this demo Smart Wizard: Demo Input Validation

Also see jQuery Smart Wizard v6 Form Validation Demo

Upvotes: 0

Adnan
Adnan

Reputation: 1409

Well guys i found the answer; How we will use jQuery Validation with smartWizard? Simply submit the form on "onFinish" call back of smartWizard, put .validate(); in the page where ever you want. Validation plugin executes on the form submission, smartWizard does not submit the form. It actually tell you that user is at the last step of wizard and just clicked the Finish button.

$('#wizard').smartWizard({
    onFinish: function() {
       $("form").submit();
    }
});

$("form").validate({
    rules: {
        username: "required"
    }
});

There are many ways to apply a rule in jQuery Validation, above is one of them!

Upvotes: 3

Related Questions