Progress in survey by pressing Enter, with different time settings for different questions | XM Community
Skip to main content

I am interested in setting progress in the survey by pressing Enter.
To do this I found the following code-

Qualtrics.SurveyEngine.addOnload(function() {
             var qid = this.questionId;
             document.onkeydown = function(event) {
                            console.log('keydown',event);
                            if (event.which == 37) {
                                          event.preventDefault();
                                         Qualtrics.SurveyEngine.registryqid].setChoiceValue(1, true);
                            } else if (event.which == 39) {
                                          event.preventDefault();
                                         Qualtrics.SurveyEngine.registryqid].setChoiceValue(2, true);
                            } else if (event.which == 13) {
                                          event.preventDefault();
                                          jQuery('#NextButton').click();
                            }
             }
});

There are questions for which I have set a time, and I do not want the subject to be able to move forward by pressing Enter. But even on questions where the code is not written, it is possible to move forward (by enter).
I noticed that after the first use of the code during the experiment, it can be used throughout the experiment, regardless of whether it is written or not for a specific question.
There is no code related to it in look & feel or anything like that.
How can I set that for certain questions it is not possible to advance with Enter, or at least it is possible to advance after X or Y time?
thank you all and have a nice day!

Please, can anyone help me?
I tried so many options and codes versions...
This is really important to me, and I'm really perplexed...


Leave a Reply