Automatically end block with forced answers after a fixed time | XM Community
Skip to main content
Dear all



I have the following problem:



I have a block of 30 "text entry" questions with "forced response" for each question. After 3 minutes participants should automatically advance to the next block.



I tried:



Qualtrics.SurveyEngine.addOnload(function()

{

var timeRemaining = parseInt("${e://Field/timeRemaining}"); //



var timer = setInterval(function() { //ruft funktion auf, 1000 = 1 mal pro Sekunde

if(timeRemaining <= 0) { //Bedingung nicht erfüllt, skip to timeRemaining--

clearInterval(timer);

$('NextButton').click()

}

timeRemaining--;

Qualtrics.SurveyEngine.setEmbeddedData('timeRemaining', timeRemaining);

}, 1000);

});



The code works. "Next" button is clicked. However, as I "force a response" for each question the error message "please answer this question" appears and participants are not avanced to the next question. I guess I need code to 1. write a value into the answer field and then 2. click next button. Or any other ideas how to solve this problem? Can somebody help?



Thanks
Hi @Kay ,



Can't you simply add a Timing question and set the allow submit after & the auto-advance after options to 3 minutes - that way participants can't move on before the 3-minute mark and once this mark arrives, then they are auto-advanced.



It is simply not possible to force response on all questions and still auto-advance them after 3 minutes - there will always be a chance that they have not finished answering the questions. Hence, the above mentioned simple approach with the Timing question should work best.



Hope that helps.



Nikolay
Hi @npetrov937



Thanks for the reply. I am not sure about your solution. My block contains 30 questions, each on a new page (page break). Within 3 minutes people can get to the next question (new page) when they answered the previous question. However, after 30 minutes they should not get to the next question, but instead directly to the next block (irrespective of how many questions they answered so far).



Do you mean that I can put a Timer Question for the whole block of 30 questions on different pages? If yes, how can I do that?



Thank you very much!
Hi @Kay ,



Oh, I see - this is slightly different from what I understood above.



The implementation of this will still depend on a few other idiosyncrasies of your project, but here's one general approach you can use.



Set up 30 different blocks with each individual question and a timing question in each page. Create a variable before all of them that will hold timing information. To control the 3 minutes on each question, use a Timer question (with its 2 associated options). To control the 30 minutes overall on all questions, add a few simple lines of JS (or embedded data - up to you) on page unload so that when the person leaves the page, then the time they spent on the page is added to the variable holding the timing information. After each block add a check whether the variables has reached 30 minutes and if so, redirect to the following sections*.



This can be improved depending on your project requirements but as a general approach it might do the trick.



Hope that helps better now.



Nikolay
Hi @npetrov937



Thanks for the help.



Kay

Leave a Reply