This is my JC code. The key codes seem to be working but no data is being reported in the file. Qualtrics.SurveyEngine.addOnload(function(){ var qid = this.questionId; document.onkeydown = function(event) { console.log('keydown',event); if (event.which == 37) { event.preventDefault(); Qualtrics.SurveyEngine.registry[qid].setChoiceValue(1, true); jQuery('#NextButton').click(); `Qualtrics.SurveyEngine.setEmbeddedData('F64', 1);` } else if (event.which == 39) { event.preventDefault(); Qualtrics.SurveyEngine.registry[qid].setChoiceValue(2, true); `Qualtrics.SurveyEngine.setEmbeddedData('F64', 2);` jQuery('#NextButton').click(); This is my work flow incase this is the problem:
I think the Set embed data block should appear before the script executes like this assuming the script executes in Block 8:I am unclear where to put the script to record the data. This is where I put it:Qualtrics.SurveyEngine.addOnload(function(){ var qid = this.questionId; document.onkeydown = function(event) { console.log('keydown',event); if (event.which == 37) { event.preventDefault(); Qualtrics.SurveyEngine.registry[qid].setChoiceValue(1, true); jQuery('#NextButton').click(); } else if (event.which == 39) { event.preventDefault(); Qualtrics.SurveyEngine.registry[qid].setChoiceValue(2, true); jQuery('#NextButton').click(); } }});Qualtrics.SurveyEngine.addOnReady(function(){ var qobj = this; setTimeout(function() { jQuery("#"+qobj.questionId+" .hideAfter45").hide(); },5000);});Qualtrics.SurveyEngine.addOnUnload(function(){ `Qualtrics.SurveyEngine.setEmbeddedData('FIELD',
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.