Closed velanchandru closed 8 years ago
call this function in show step callback
function fnDisableFinishButton(iCurrentStep, iFinishStep, oFinishButton) {
oFinishButton = oFinishButton || $(".actionBar .buttonFinish")
iFinishStep = iFinishStep || 3
if (oFinishButton && iCurrentStep == iFinishStep) {
oFinishButton.removeClass('buttonDisabled')
} else if (oFinishButton) {
oFinishButton.addClass('buttonDisabled')
}
}`
What values do I pass into this new function?
Hei,
I just found this solutions, just add this simple code in every step in wizard
if($('button.sw-btn-next').hasClass('disabled')){
$('.sw-btn-group-extra').show(); // show the button extra only in the last page
}else{
$('.sw-btn-group-extra').hide();
}
Here Is The Full Code :
$("#smartwizard").on("showStep", function(e, anchorObject, stepNumber, stepDirection) {
if($('button.sw-btn-next').hasClass('disabled')){
$('.sw-btn-group-extra').show(); // show the button extra only in the last page
}else{
$('.sw-btn-group-extra').hide();
}
});
The Explanation is so simple,showStep function handle every step in wizard ( from step 1 to 2, etc ) Then we just need to check is button with class btn-next(class next button) has disabled class, as we know the next button disabled when the page is last.
Hope this help.
Hi, Solution
$("#smartwizard").on("showStep", function (e, anchorObject, stepIndex, stepDirection) {
setTimeout(function () {
if ($('button.sw-btn-next').hasClass('disabled')) {
$('.finish').show(); // show the button extra only in the last page
} else {
$('.finish').hide();
}
}, 500);
});
you made my day
Hi guys,
i want hide the Finish button while coming backwards.i want to show only if the user in the last step and sample code on how to use on showstep, i know its possible to set this in onShowstep but if i did something in the onShowstep method Wizard not render properly it gets collapsed i tried the following but no luck.
as StuartMorris said:
onShowStep: function(){ var currentStep = $("#wizard").smartWizard("currentStep"); if(currentStep) { HideShowSubmit(currentStep); }
function HideShowSubmit(step) {