Which lines/ bits do you think I can remove to avoid displaying the counter/timer to participants? Alternatively, can you provide a code that autoadvances to the next block when a timer is up without displaying the timer to participants?
Thank you!Solved
Move to Next Block after Specific Time
Hello,
I have a block with 20 questions.
After 4 minutes, I'd like for participants to move on to the next block (regardless of how many questions they saw in the current block).
To achieve this, I was able to use code from here: https://stackoverflow.com/questions/47317718/how-to-use-automatically-move-respondents-in-qualtrics-with-global-timer-for-blo to automate the process.
The problem is that the code I used displays a countdown to the participants. I don't want participants to know the time remaining. When I try to remove bits of the code that display the timer to participants, the code breaks down.
Here's the code I am currently using. Note: I have an embedded variable called "timeRemaining" and for each subsequent question in the same block, I have a display logic that is set to "if timeRemaining > 0"
!
Which lines/ bits do you think I can remove to avoid displaying the counter/timer to participants? Alternatively, can you provide a code that autoadvances to the next block when a timer is up without displaying the timer to participants?
Thank you!
Which lines/ bits do you think I can remove to avoid displaying the counter/timer to participants? Alternatively, can you provide a code that autoadvances to the next block when a timer is up without displaying the timer to participants?
Thank you!Best answer by sbsphd
Solved. Here's the code:
Qualtrics.SurveyEngine.addOnload(function()
{
function startTimer(duration) {
var timer = duration;
var myTimer = setInterval(function() {
Qualtrics.SurveyEngine.setEmbeddedData('timeRemaining', timer);
if (--timer < 0) {
clearInterval(myTimer);
timeOver();
}
}, 1000);
}
var timerSeconds = parseInt("${e://Field/timeRemaining}");
startTimer(timerSeconds);
var timeOver = function() {
$('NextButton').click();
}
});
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
