I,m using SmartWizard in my project for getting the user registered with my web site. But i want to save all the data at the step 3 where the wizard has four steps. The wizard submits the form after clicking the finish button. Below code will describe my assumptions and can any one suggest a way to do this. Thanks.
function validateAllSteps(){
var isStepValid = true;
if(validateStep1() == false){
isStepValid = false;
$('#wizard').smartWizard('setError',{stepnum:1,iserror:true});
}else{
$('#wizard').smartWizard('setError',{stepnum:1,iserror:false});
}
if(validateStep2() == false){
isStepValid = false;
$('#wizard').smartWizard('setError',{stepnum:2,iserror:true});
}else{
$('#wizard').smartWizard('setError',{stepnum:2,iserror:false});
}
return isStepValid;
}
function validateSteps(step){
var isStepValid = true;
// validate step 1
if(step == 1){
if(validateStep1() == false ){
isStepValid = false;
$('#wizard').smartWizard('showMessage','Please correct the errors in step'+step+
' and click next.');
$('#wizard').smartWizard('setError',{stepnum:step,iserror:true});
}else{
$('#wizard').smartWizard('setError',{stepnum:step,iserror:false});
}
}
// validate step 2
if(step == 2){
if(validateStep2() == false ){
isStepValid = false;
$('#wizard').smartWizard('showMessage','Please correct the errors in step'+step+
' and click next.');
$('#wizard').smartWizard('setError',{stepnum:step,iserror:true});
}else{
$('#wizard').smartWizard('setError',{stepnum:step,iserror:false});
}
}
return isStepValid;
}
//start of step one validation
//end of of step one validation
//step 2 validation
//end of step 2 validation
var res=validateAllSteps();
if(res == true)
{
$('#form1').submit();
}
Modify the plugin so that you will have another button, say "save Partial". Then add an event handler that is called something like "onSavePartial". During initalization of the plugin u can add the callback to be called. Then submit your form inside this call back.
And here is the onSavePartialCallBack Function
NB You have to hack the plugin for it to show the button, and to handle onSavePartial thingy