Hidden/disabled Next button | XM Community
Skip to main content

I am running into an odd issue. I am using JavaScript to hide the Next button until someone interacts with the question and the validation check is met. This is being used on constant sum questions. The script works fine (see script below), however, if there are two or more constant sum questions in sequence, although with a page break between each question, the script won’t automatically disable the Next button for all subsequent questions. Interestingly, the button will become disabled when someone interacts with the subsequent questions but the issue is that if someone does not interact with the question at all and chooses to hit the Next button, they will be able to skip that question.

I was trying to figure out what the issues was, and to make things weirder (and clearer at the same time), the issue persists only if the questions with the JavaScript I described are in consecutive pages. If I add a a question in between the two constant sum questions and each question has its own page, then the script does its job and works fine. Essentially, the issue only rises when the constant sum questions are in consecutive pages. I’ve added hidden questions in between but that does not fix the issue.
I cannot add the validation check ‘Must total to 100’ because I am using that feature for another validation check I need.

Any suggestions?
 

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
this.hideNextButton();

});

Qualtrics.SurveyEngine.addOnReady(function () {
    let quest = this,
        qc = quest.questionContainer,
        id = quest.questionId,
        total_box = qc.querySelector("#" + id + "_Total");

    total_box.oninput = function () {
        quest.disableNextButton();

        if (total_box.value == 100) quest.enableNextButton();
        if (total_box.value == 100) quest. showNextButton();

    };
});

Under Look & Feel tab → Motion, make sure Page transistion is set to none.


Thank you @Shashi . Easy fix.


Leave a Reply