javascriptqualtricsuser-inactivity

How to auto-advance due to inactivity on Qualtrics


I would like to auto-advance my participants in a Qualtrics survey to the next question (on the next page) after they have been inactive for 10 seconds. My inactivity code is working fine (see below, from Kirupa) but I can't figure out how to force the survey to move on. Any ideas?

Code:

Qualtrics.SurveyEngine.addOnload(function()
{
    /*Place Your Javascript Below This Line*/

    var timeoutID;

function setup() {
    this.addEventListener("mousemove", resetTimer, false);
    this.addEventListener("mousedown", resetTimer, false);
    this.addEventListener("keypress", resetTimer, false);
    this.addEventListener("DOMMouseScroll", resetTimer, false);
    this.addEventListener("mousewheel", resetTimer, false);
    this.addEventListener("touchmove", resetTimer, false);
    this.addEventListener("MSPointerMove", resetTimer, false);

    startTimer();
}

setup();

function startTimer() {
    // wait 10 seconds before calling goInactive
    timeoutID = window.setTimeout(goInactive, 10000);
}   


    function resetTimer(e) {
    window.clearTimeout(timeoutID);

    goActive();
}
 function goInactive() {
    // Here is where the auto-advance code needs to go

}

    function goActive() {

    startTimer();
}


});

-- Thanks!


Solution

  • Add this line to the goInactive function:

    $('NextButton').click();