Community Groups are officially here!
We've released Groups, a new feature that enables us to connect community members of similar industries and interests in a shared, private space. You can check out all of the details here, including information about who can join, how to join, and what Groups are currently offered. Please leave your feedback through this Community Groups Feedback Survey.

How to set auto-advance on my survey?

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

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

  • AlexB
    AlexB PhiladelphiaFounding Community Member, Community Member 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

  • AnthonyR
    AnthonyR Tucson AzFounding Community Member, 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();
            }); 
        }
    });
    
  • Barnaby
    Barnaby 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?

  • AnthonyR
    AnthonyR Tucson AzFounding Community Member, 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_nbbj
    csmith_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?

  • AnthonyR
    AnthonyR Tucson AzFounding Community Member, Community Member Superuser ✭✭✭✭

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

  • MLW88
    MLW88 LondonCommunity Member - Trial User 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?

  • fvelasquez
    fvelasquez SeattleCommunity Member, Qualtrics Brand Admin 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.

  • cbwin_Penn
    cbwin_Penn Community Member Qubie ✭

    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?