Dynamically updating the number of steps in the FuelUX wizard

I hope someone can be helpful to help me with this. I use the FuelUX wizard and want to dynamically add X the number of steps, where X is the number that the user specified on the first screen. Additional steps are added perfectly, except that I can’t understand how to tell the master that now he has a different number of steps to where he started, so if he started with 3 steps, he still wants to send the form after step 3, no matter how much he now has.

The call $('#MyWizard').wizard()does not work again. There is a variable in the wizard code numSteps, but it is not possible to access it from outside the class. This solution can also be found on the external website of Rob Schmucker ( http://www.robschmuecker.com/dynamic-steps-in-fuel-ux-wizard/ ), but, unfortunately, it does not work for me and calls $('#MyWizard').data('wizard', '')like he offers, prevents the master from stepping forward at all.

Does anyone have any suggestions / experience with this problem? I am new to JS etc., so maybe this is obvious, any help would be much appreciated! The code where I add the steps is below:

var added_questions = 0;
function addStep()
{
  added_questions++;
  $("#end-of-questions-step-marker").before("<li id='#step-marker-q" + added_questions + "' data-target='#q" + added_questions + "'><span class='chevron'></span>Q" + added_questions + "</li>");
  $("#step3").before("<div class='step-pane' id='q" + added_questions + "'><fieldset id='q" + added_questions + "-fieldset' class='col-sm-12'></fieldset></div>");
  $("#q" + added_questions + "-fieldset").append(getQuestionPanel(added_questions));
}
+4
source share
1 answer

, FuelUX 2, 3 FuelUX addSteps . . , ( ), 2 FuelUX 3.0:

$('#myWizard').wizard('addSteps', index, [
  {
    badge: 'badge-customicon',
    label: 'A Step Label',
    pane: '<div>Content</div>'
  }
]);

FuelUX 3 .

+2

Source: https://habr.com/ru/post/1538566/


All Articles