Search code examples
javascriptsurveyqualtrics

Selectively disabling "Next Button" in Qualtrics for specific questions


I haven't played with any coding in years and I am struggling with understanding the template that Qualtrics provided for disabling the "Next Button" in a survey. The "Next Button" doesn't have to be disabled entirely (could be colored white). Since the survey is for research purposes, I need to keep the button from distracting participants on timed questions.

These are the two pages that I have looked at for coding.

https://s.qualtrics.com/WRAPI/QuestionAPI/classes/Qualtrics%20JavaScript%20Question%20API.html

https://www.qualtrics.com/wp-content/uploads/2011/07/Qualtrics-Question-API.pdf

If you have a better way to code this, or could explain the coding outline in greater depth for me, I'd appreciate the help.


Solution

  • A couple of things:

    1. Due to a recent change in Qualtrics, Anthony's solution doesn't always work in JFE. Sometimes the JS runs before the buttons are present. The solution is defer hiding the buttons:

      Qualtrics.SurveyEngine.addOnload(function() {
          function hideEl(element) {
              if($(element)) $(element).hide();
          }   
          hideEl.defer('NextButton');
      });
    2. To eliminate the brief button flash while waiting for JS to do its thing, you can add a style tag at the end of the question text instead:

      <style>
           #NextButton {display:none;}
      </style>