Block Timing Help | XM Community
Skip to main content

We are designing a study that involves a list of words, a distractor task, and a test. For the distractor task, they complete math verification problems (e.g., 4 + 6 = 10 ?True or False) for 1 minute. This means that we will either need to resample problems randomly, or sample from a very long list that even the fastest participant cannot complete in 1 minute.
 
What we cannot figure out is how to get Qualtrics to advance to the next block after 30 seconds. We tried defining “timeleft” as 30 seconds and using the following code. But after the 30 seconds are up, Qualtrics then rapidly displays and automatically advances past all remaining items. This is unacceptable because it is 1) confusing and 2) takes up time when time is what we want to control.

"Qualtrics.SurveyEngine.addOnload(function()  
{
var that = this;
this.questionclick = function(event,element){
if (element.type == 'radio') {
that.clickNextButton();
}
}
var timeleft = parseInt("${e://Field/TimeLeft})");
var timer = setInterval(function(){
if(timeleft <= 0){
clearInterval(timer);
$('NextButton').click();
}
timeleft--;
},1000);
$('NextButton').onclick = function (event) {
Qualtrics.SurveyEngine.setEmbeddedData('TimeLeft', timeleft);
}
});
Qualtrics.SurveyEngine.addOnReady(function()
{
  $('NextButton').hide();
  $('PreviousButton').hide();
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
  $('NextButton').hide();
  $('PreviousButton').hide();
});"
cleardot.gif

If the above mentioned code is written for distractor task, and you also want to control it to 1 min, then instead of this, just use single question and create a duplicate next button with actual next button hidden. In this question, start a timer as soon as page loads. On click of duplicate button generate a math equation true or false randomly and set it to question text. Once the interval is over click the original next button.


Leave a Reply