So, I have a set of 20 questions (each on a separate site), where participants have 5 minutes to work on it. We already implemented this by declaring the timer variable as embedded data and substracting the time from this timer with the following code:
Qualtrics.SurveyEngine.addOnload(function()
{
var timeRemaining = parseInt("${e://Field/timeRemaining}");
var timer = setInterval(function() {
if(timeRemaining <= 0) {
clearInterval(timer);
$('NextButton').click()
}
timeRemaining--;
Qualtrics.SurveyEngine.setEmbeddedData('timeRemaining', timeRemaining);
}, 1000);
});
By then adding a DisplayCondition to all questions which require the embedded counter to be larger than 0, we can skip all following questions and proceed to the point where we want. This works pretty good without force response.
There is, however, still one big problem. This solution does not work with force response. Once the above code executes NextButton.click, qualtrics gives an error that there should be an answer in that box. Moreover, even after giving an answer (after this error occurred), qualtrics will skip to the end of the survey instead of to the next block without a displayCondition (which is weird?).
Since we need force response to the questions, it would be nice to find a workaround.
I was thinking about including a piece of code that sets an answer for the question (like -999) and then the force response mechanism will accept this as a response? I am not sure how to implement this but the API provides some commands:
setChoiceAnswerValue
setChoiceValue
setChoiceValueByRecodeValue
setChoiceValueByVariableName
So my idea is to include one of those commands to the code of each question, thereby set response to the question before executing the button.
Is this possible? How would the code look like (I tried but not manage). Or is there another solution?
Thanks!
Jonas
Best answer by Jonas
View original