How to set auto-advance on my survey? | XM Community
Solved

How to set auto-advance on my survey?

  • 11 November 2017
  • 9 replies
  • 758 views

Userlevel 3
Badge +1
How can I make my survey auto-advance using JavaScript so that after a person selects the answer to a question, it auto-advances to the next page?
icon

Best answer by AlexB 21 November 2017, 16:49

View original

9 replies

Userlevel 7
Badge +7
Assuming we are only talking about single punch multiple choice questions, you can use the following:

Qualtrics.SurveyEngine.addOnReady(function()
{
var that = this;
var answers = $$(".SingleAnswer");
for(var x = 0; x<answers.length;x++){
answers[x].observe('click', function(event) {
that.clickNextButton();
});
}
});
Userlevel 3
Badge +1
Thanks, @AnthonyR - this is close but doesn't exactly work for me.

I have multiple questions on the same page & only want the final question to auto-advance. When I use the JS above, it auto-advances when I select any answer. How can I specify the question I want to have this behavior?
Userlevel 3
Badge +2
You can use this code on the last question of the page:

Qualtrics.SurveyEngine.addOnload(function()
{
var that = this;
this.questionclick = function(event,element){
if (element.type == 'radio') {
that.clickNextButton();
}
}


});
Userlevel 7
Badge +7
> @AlexB said:
> You can use this code on the last question of the page:
>
> Qualtrics.SurveyEngine.addOnload(function()
> {
> var that = this;
> this.questionclick = function(event,element){
> if (element.type == 'radio') {
> that.clickNextButton();
> }
> }
>
>
> });

This should work perfectly, though honestly I warn against this functionality if you have multiple questions on a page. Respondents often times look at all the questions on a page and don't always answer in order. Auto-advancing may also lead to problems for respondents who accidentally clicked the wrong answer. When we attempted to do this, it was our number one complaint.
> @AlexB said:
> You can use this code on the last question of the page:
>
> Qualtrics.SurveyEngine.addOnload(function()
> {
> var that = this;
> this.questionclick = function(event,element){
> if (element.type == 'radio') {
> that.clickNextButton();
> }
> }
>
>
> });

Sorry, I'm a total noob, but where exactly would you embed this code in the question?
Userlevel 7
Badge +7
click the gear icon on the left side, click "Add JavaScript" and paste the code in the box that pops up
Hi @AnthonyR - I have one slider question in place, do you know what changes I would need to make to the code above to have the survey auto-advance once the respondent has made their selection?
What is the best practice for when you want auto advance on your multiple choice questions but then you have a multiple choice that also allows text entry (e.g. an 'Other' category)?

I was thinking I would need an auto advance on all options other than the one that allows for text entry. Has anyone created code for this? My team is having trouble creating this in an efficient way.

How can you progress to the next page when the question type is not radio multiple choice? I have a multiple choice question but set up as a select box that gives a list of options (over 300+), but I can't figure out the question type for JS that will allow me to have users click an option and then be sent to the next page. Any ideas?

Leave a Reply