I have built a simple experiment that requires participants to make a judgement on a photograph. They press on of three buttons (J, K or L) and the page moves on to the next photograph. I use the following code to advance the page with the keys and hide the submission button.
However, Qualtrics is not recording the key pressed as a response/answer (J, K or L). The questions are multiple choice questions. Is there a simple mistake anybody else can see in this code or in the questions that i cannot see?
Do i need to code values within the answers? Please 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 74: // 'J' was pressed
choiceID = 1;
break;
case 75: // 'K' was pressed
choiceID = 2;
break;
case 76: // 'L' was pressed
choiceID = 3;
break;
}
if (choiceID) {
Event.stopObserving(document, 'keydown', keydownCallback);
that.setChoiceValue(choiceID, true);
that.clickNextButton();
}
});
});
Question
Keyboard responses not recorded as answers.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

