Community Groups are officially here!
We've released Groups, a new feature that enables us to connect community members of similar industries and interests in a shared, private space. You can check out all of the details here, including information about who can join, how to join, and what Groups are currently offered. Please leave your feedback through this Community Groups Feedback Survey.

Is there a way to hide next button until slider value is equal to loop&merge field number?

michalkohuttn
michalkohuttn Community Member Qubie ✭

Hello,

I would like to use loop and merge function in block with just one slider. The participant has to select number specified in loop and merge field "Select the number ${lm://Field/1} ". In these fields I have random number generator (${rand://int/1:100}). Is there a way, to validate, that participant selected the presented number? If yes, he/she can continue to next loop, if not, he/she can't continue or there is no next button. I was searching for answer, but I can't find solution. Thank you very much.

Best Answer

  • ahmedA
    ahmedA IndiaCommunity Member, XMPN Member Wizard ✭✭✭✭✭
    Accepted Answer

    This was quite an interesting question. Add this to your JS:

    Qualtrics.SurveyEngine.addOnReady(function () {
        let quest = this,
            ip = quest.questionContainer.querySelector(".ResultsInput"),
            val = "${lm://Field/1}",
            nb = document.querySelector("#NextButton");
    
    
        nb.hide();
        ip.onchange = function () {
            if (ip.value == val) nb.show();
            else nb.hide();
        };
    });
    


    However, if this is an attention test, I think its a bit too difficult. Demo

Answers