Search code examples
jquery-pluginsformwizardjquery-form-wizard

How to notify the FormWizard plugin about skipped steps (not shown) to avoid losing data?


I have the formwizard plugin integrated with an 8-step form; The problem is, whenever I'm trying to edit information and then jump to an specific step in the form so basically jumping ignoring previous steps, all steps that were not shown (cuz I jumped them) are not sent!!! :( so losing all data already populated into those fields.

For example,

$("#demoForm").formwizard("show","Step4");

This will trigger Step4, but if I am at Step1 and havent seen Step2 and Step3, and jump right into Step4.. then the plugin ignores those Step2 and 3 so when my processing script will process empty data. I would like to know how to notify the plugin that there are steps that were now shown in order to submit those values.

Note: I'm not using Ajax for this.

This is where the settings are:

$("#demoForm").formwizard({
    formPluginEnabled: false, 
    validationEnabled : true, 
    disableUIStyles : true,
    textNext: "Siguiente",
    textBack: "Anterior",
    textSubmit: "Guardar",
    focusFirstInput : true
},
{
    messages: { email: "Invalid email"} 
},
{
    // form plugin settings                     
}
);

Jumping to an specific step like this...

$('#gotostep').change(function(){
    if($(this).val() != '')
    {
        $("#demoForm").formwizard("show",$(this).val());
        return false;
    }
});

..same thing happens if I try to force a submit changes on any steps using: $("#demoForm").submit(); :/

Thanks in advanced! Frank


Solution

  • I guess it should suffice to enable all disabled input elements in the form when the form is submitted? Do this e.g. by hooking up a callback to the forms submit event like this:

    $(function(){
        var form = $("#demoForm");
        form.submit(function(){
              form.find(":input:disabled").removeAttr("disabled");
        })})
    

    Hope this helps.