4

I am creating a wizard control pages using the FuelUX wizard plugin http://getfuelux.com/javascript.html#wizard

And I am trying to disable the NEXT button only on the STEP1 of the wizard.

Kindly check this image for better understanding: https://i.stack.imgur.com/YLbnl.png

I would love to have some help on this. Let me know if need anything from my side.

NorthCat
  • 9,643
  • 16
  • 47
  • 50
MercuryUIX
  • 71
  • 2
  • 6

3 Answers3

2

Ok. After much research I just have this solution for you. You need to modify the plugin fuelux.js. Take unminified version of fuelux.js and find below line of code

var canMovePrev = ( this.currentStep > 1 ); //remember, steps index is 1 based...
var isFirstStep = ( this.currentStep === 1 );
var isLastStep = ( this.currentStep === this.numSteps );

// disable buttons based on current step
if ( !this.options.disablePreviousStep ) {
         this.$prevBtn.attr( 'disabled', ( isFirstStep === true || canMovePrev === false ) );
}

// change button text of last step, if specified
var last = this.$nextBtn.attr( 'data-last' );
if(isFirstStep) //Add this line
{
    this.$nextBtn.attr( 'disabled', ( isFirstStep === true || canMoveNext === false ) );
}

The above line you can find it in setState: function() { which is in Line number 3652

Let me know if you face any issue

EDIT: and to work with you alternate next button you can write it as below

$(document).ready(function(){
   $('.btnext').on('click',function(){
         $('.wizard').wizard('next');
         $nextBtn = $('.wizard').find( 'button.btn-next' );
         $nextBtn.removeAttr('disabled');
    });
});

Add your alternate button wherever you want and just add a class btnext to it.

Guruprasad J Rao
  • 29,410
  • 14
  • 101
  • 200
0

I really tried all the suggestions given by peoples. I dont know why none seemed to work for me. May be bacause I didn't provide enough information. Out of several methods I tried. I found this one to be the easiest.

protected void NextButton_Click(object sender, WizardNavigationEventArgs e)
{
       //Suppose You have a control on your webpage. Just check if it has
       //the information you require. In my case lblpasskeytextbox
       //and if the condtion is not fulfilled I am not letting user to move
       //next page
        if (lblPasskeyInformation.Text[0] == 'I')
        {
            e.Cancel = true;
            return;
        }
}
code_love
  • 128
  • 6
0

After reading the fuel ux documentation, here seems to be a hack that allows you to disable a specific step without modifying any source fuelux.js code.

    $wizard.on('actionclicked.fu.wizard', function (evt) {

    //Check the current step 
    var currentStep = $wizard.wizard('selectedItem').step;

    //If current step needs to be disabled, disable it and then return.
    if (currentStep === 1)
    {
        evt.preventDefault();
        return; 
    }



});

Please note that $wizard here is just my way of saying $('#myWizard') as described in the fuel ux documentation.

hlyates
  • 1,279
  • 3
  • 22
  • 44