Custom Message on Auto advance | XM Community
Skip to main content

Hi!
I've developed a response-time task in which people must choose one of two options before proceeding to the next question. Upon selecting a choice by pressing one of two buttons on their keyboard, they automatically proceed to the next question.
In addition, if they do not answer the question within 2.5 seconds, they automatically proceed to the next question.
In the latter case, I'd like to display a warning message such as, "Respond faster" People should see that message for a second or two before viewing the next item.
Can this (displaying a temporary warning message) be done?
-------------------------------------------------
If helpful, here is my current Javascript:
Qualtrics.SurveyEngine.addOnload(function()
{
this.hideNextButton();
this.hidePreviousButton();
var that = this;
Event.observe(document, 'keydown', function keydownCallback(e) {
var choiceID = null;
switch (e.keyCode) {
case 65: // "a"  was pressed  for chart of cases go to...  https://www.w3schools.com/charsets/ref_utf_basic_latin.asp
choiceID = 1;
break;
case 76: // "l" was pressed.
choiceID = 2;
break;
}
if (choiceID) {
Event.stopObserving(document, 'keydown', keydownCallback);
that.setChoiceValue(choiceID, true);
that.clickNextButton();
}
});
});

task.jpgAlso, this is what the task itself looks like.


First thought was alerts, but they only have alert, prompt, and confirm. However, I found this article on SO that does an auto-closing div. With a little bit of work and CSS, I could see this working for you. Specifically check out the jsfiddle demo in the first answer.


https://community.qualtrics.com/XMcommunity/discussion/comment/41316#Comment_41316Thanks Jeremy!
I'll keep fiddling, but haven't got it to work so far. But that's because I'm quite inexperienced (I barely managed to cobble together the original code, above. hah!)
This does look promising, though. I'll keep trying.


Yeah, what you're looking to do is pretty heavy.... Even if you make the div work, the timer of 2.5 seconds would have to be paused while the message "Respond faster!" is displayed and that complicates matters even more. Maybe look for a JavaScript extension to handle the pop-up easier? Or you could try adding the div element to the question body at the top of the question text and (using JavaScriprt) only display the div if the next button was fired via API rather than user-clicked.
I don't know, it's a lot any way you slice it.


Leave a Reply