Hi all,
I have a set of 20 questions in Block 1 (with page breaks between each question). I am trying to make participants auto-advance to Block 2 after 1 minute on Block 1 regardless of whether they have answered all or not. I did not use the force response option.
This is what I have done so far:
1) Set timeRemaining = 60 on Survey Flow
2) Add in Java codes that I found from other threads on the first question of Block 1
Qualtrics.txt
The codes worked well to count down from 60s, but when it comes to auto-advance, it advances to the next question that the participant has not answered in Block 1 instead of going to Block 2.
I am fairly new to Java, is anyone able to help with this? Specifically, which line do I have to remove or modify on the script?
Page 1 / 1
This code should do the job for you. I haven't looked at what you pasted, it appeared to be too long and complicated. The code below is simple, you'll have to paste it in the JS section for each question. For it to work properly, you'll have to to do three things:
- Create an embedded data field named "remaining_time" and set its value to the maximum time you want to give. (in seconds)
- Create an embedded data field named "time_over" with value as "false"
- Add a display logic from question 2 onwards to be only shown when "time_over" is equal to "false".
Qualtrics.SurveyEngine.addOnload(function () {
var time_calc;
});
Qualtrics.SurveyEngine.addOnReady(function () {
//Get the remaning time
var rem_time = "${e://Field/remaining_time}";
rem_time = parseInt(rem_time);
that = this;
time_calc = setInterval(function () {
rem_time = rem_time - 1;
// Update the remaining time every second
Qualtrics.SurveyEngine.setEmbeddedData("remaining_time", rem_time);
if (rem_time <= 0) {
clearInterval(time_calc);
// This line will create and alert that time is up. Delete it or you may change its text as you please.
alert("times up");
// This will skip the other questions and go the end of the block
// Ensure that you have display logic set up accordingly
Qualtrics.SurveyEngine.setEmbeddedData("time_over", "TRUE");
// Auto advance
that.clickNextButton();
}
}, 1000);
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
clearInterval(time_calc);
});
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.