Enabling Button not working as intended | XM Community
Skip to main content
Solved

Enabling Button not working as intended

  • October 26, 2018
  • 2 replies
  • 61 views

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.

Best answer by NiC

replace` this.clickNextButton();` with `jQuery("#NextButton").click() ;`

2 replies

NiC
QPN Level 5 ●●●●●
Forum|alt.badge.img+27
  • QPN Level 5 ●●●●●
  • 255 replies
  • Answer
  • October 26, 2018
replace` this.clickNextButton();` with `jQuery("#NextButton").click() ;`

  • Author
  • 4 replies
  • October 31, 2018
Thank you!