Question
How can I add a timeout message for individual questions?
I have a serious of questions that are all presented on different pages. On each page, I have also added a "Timing" item to display a countdown clock. If the countdown clock reaches zero, I want an error message to pop up. Currently I am using the following code for each Question Javascript to show an error message after 4 seconds:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
setTimeout(function(){
alert("Time is up. Please choose an answer and move to the next question.");
}, 4000);
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
This code displays an error message after 4 seconds if I stay on a question. However, if I advance quicker than 4 seconds, the timeout error message carries over and will appear in the middle of the countdown on the next page (e.g., If I advance after 3 seconds, the next question will pop up an error message when the countdown has only gone down by 1 second). Do you have advice on how to avoid this carry over? Thank you for your help!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.