Hi! I created a lexical decision task in Qualtrics using javascript. Two letter strings are displayed on the screen. Subjects have to respond whether they are both words (by pressing f) or if either one is a nonword (by pressing j). The survey then autoadvances to the next question when a button is pressed. I also have a timer attached to each question, so that I get a response time. The problem I'm having is that I'm not seeing what button (j or f) was pressed for each of these questions. In fact the question number is not even displaying in the data. I'm only getting the response time from the timer. My javascript is pasted below. Can you help me figure out how to get the response to come through in the data? Thanks for your help!
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 70: // 'f' was pressed
choiceID = 1;
break;
case 74: // 'j' was pressed
choiceID = 2;
break;
}
if (choiceID) {
Event.stopObserving(document, 'keydown', keydownCallback);
that.setChoiceValue(choiceID, true);
that.clickNextButton();
};
});
});
;
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
Page 1 / 1
Try consoling the key pressed using event or maybe setting an embedded whichever seems easy.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.