How to set auto-advance on my survey?

BarnabyBarnaby Provo, UTFounding Community Member CEP (Chief Executive Paw-ficer)

How to set auto-advance on my survey?

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?

Best Answer

  • AlexBAlexB Philadelphia Guru ✭✭
    Accepted Answer

    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();
    }
    }

    });

Answers

  • AnthonyRAnthonyR Tucson AzFounding Community Member Superuser ✭✭✭✭

    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();
            }); 
        }
    });
    
  • BarnabyBarnaby Provo, UTFounding Community Member CEP (Chief Executive Paw-ficer)

    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?

  • AnthonyRAnthonyR Tucson AzFounding Community Member Superuser ✭✭✭✭

    @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.

  • csmith_nbbjcsmith_nbbj Seattle, WACommunity Member - Trial User Qubie ✭

    @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?

  • AnthonyRAnthonyR Tucson AzFounding Community Member Superuser ✭✭✭✭

    click the gear icon on the left side, click "Add JavaScript" and paste the code in the box that pops up

  • MLW88MLW88 LondonCommunity Member Qubie ✭

    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?

  • fvelasquezfvelasquez SeattleCommunity Member Qubie ✭

    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.

Sign In to Comment