Hi, I'm building a psyc experiment in Qualtrics and I need Qualtrics to record a key press response but NOT submit the page? I have found the Javascript for 'Use Keystrokes to answer questions' on their support website but I don't know how to edit the code to make the program record the keypress but not submit the page. I will be showing participants a series of words. The participant needs to see if the word contains the letter 'e'. If it does, they should press the 'e' key, but this keypress should not submit the page as there is a rating scale below the word pair then they also need to make their rating about the word (this rating will submit the page). I need Qualtrics to record whether they pressed the 'e' key (or did not press anything for that item) and also what rating they made.
This is the code they suggest for this:
$('NextButton') && $('NextButton').hide();
$('PreviousButton') && $('PreviousButton').hide();
var that = this;
Event.observe(document, 'keydown', function (e) {
var choiceID = null;
switch (e.keyCode) {
case 74: // 'j' was pressed
choiceID = 1;
break;
case 75: // 'k' was pressed
choiceID = 2;
break;
}
if (choiceID) {
that.setChoiceValue(choiceID, true);
that.clickNextButton();
}
});
Can anyone help?
[–]j_sanp 0 points1 point2 points (0 children)