Enabling Button not working as intended

williamwengwilliamweng LACommunity Member Qubie ✭
edited October 2018 in Custom Code

Enabling Button not working as intended

Hello everyone,

I am new here, so please bare with me if my format is wrong.

Here is what's going on. I have a custom next button using JS. After clicking on custom next button twice, it will have a popup asking user to confirm. What I want is, if the user is sure, then I can record what his answer was (as an embedded data field) and go on to the next question.

However, a weird problem occurred, I can only record the user choice but cannot let it automatically go on to the next page.

Here is the code inside addOnload function.

 if(buttonStatus){
            if(confirm('Are you saying that if I offer you $' + (parseInt(confirmFinal())+1) + ', you will take it and not take the gamble? And if I offer you $'+ (parseInt(confirmFinal())-1) + ', you would take the gamble for sure?')) {

                  this.clickNextButton();

                Qualtrics.SurveyEngine.setEmbeddedData('userChoice1', confirmFinal() );

                return;
            }
            else{

                resetCells();

            buttonStatus = false;

            return;


            }
        }

I also used Qualtrics.SurveyEngine.clickNextButton() and didn't work.

Tagged:

Best Answer

  • NiCNiC Mumbai Superuser ✭✭✭✭
    edited October 2018 Accepted Answer

    replacethis.clickNextButton();
    with jQuery("#NextButton").click() ;

Answers

Sign In to Comment