I use auto advance in some questions and my survey keeps auto advancing in the following questions | XM Community
Question

I use auto advance in some questions and my survey keeps auto advancing in the following questions

  • 10 March 2021
  • 6 replies
  • 298 views

Badge

Hi!

I have 4 questions in one block, separated into 3 pages. I want to auto-advance, but for some reason it keeps auto-advancing in the following block (for which I added no code).
The first question has its own page and I want it to auto-advance after the participant choses an option or after 6 seconds. I used the following code:
this.hidePreviousButton ();
this.hideNextButton();
var that = this;
(function(){that.clickNextButton();}).delay(6);
that.questionclick = function(event,element){if (element.type == 'radio'){that.clickNextButton()}}

The second question also has it own page, and I want it to auto-advance after 1 second. It is information only and participants do not need to answer. I used the following code:
this.hidePreviousButton ();
this.hideNextButton();
var that = this;
(function(){that.clickNextButton();}).delay(1)

The third and fourth question share the last page. I want to auto advance after 10 seconds. I used the following code in the third question:
this.hidePreviousButton ()
var that = this;
(function(){that.clickNextButton();}).delay(10);

For some reason, the third page auto advances after 1 or 2 second aprox, and surprisingly, the survey keeps auto-advancing, even in the next block (for questions that have no code at all!!!). If I delete this line that.questionclick = function(event,element){if (element.type == 'radio'){that.clickNextButton()}} from the first question, the problem is solved but of course, I don't get to auto-advance in the first question whenever a choice is selected but rather only after 6 seconds.
All code is under Qualtrics.SurveyEngine.addOnload(function(){}), but I tried to move it (and parts of it) to addOnReady with no success.
Any insights on why this problem might by and more importantly, how to solve it!?

Thank you in advance


6 replies

Userlevel 7
Badge +27

delay() is a prototypejs wrapper for setTimeout. You need to clear the timeout in your click button handler or it stays active and clicks the Next button on a subsequent page.

I have a related "next button" question.
I figured how to show the next button with delay and also how to activate it with answering a question. But now I want to combine these two.
My participants have to answer a series of questions in a block without the next button being visible. Within the block, the next questions only appears when they have answered the previous one. I handle this with display logic.
When they answer the last question in the block, the next button should appear but with a delay - 3 seconds after the last question is answered.
Is there a way to do this?

Badge

https://www.qualtrics.com/community/discussion/comment/35473#Comment_35473I've been trying to do so' but didn't understood how to...

Userlevel 7
Badge +27

Your Q1 code with modifications:
Qualtrics.SurveyEngine.addOnload(function() {
this.hidePreviousButton();
this.hideNextButton();
var that = this;
var to = setTimeout(function(){
that.clickNextButton();
},6000);
that.questionclick = function(event,element){
if (element.type == 'radio') that.clickNextButton();
};
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
clearTimeout(to);
});
});

Userlevel 2
Badge +1

Hi! I wonder how you solved it!

Userlevel 7
Badge +27

Hi! I wonder how you solved it!

See the post immediately before yours.

Leave a Reply