TomG, Thank you so very much! It worked (as I’m sure you knew it would. You’re amazing! Ralph
Hi there, Your code/process seemed to work out for me in terms of logging the time. The only difference is that I had to add the following code to my JS at the bottom: Qualtrics.SurveyEngine.addOnUnload(function() { timer = clearInterval(); }); This is, of course, if "logged to the console" means logged as an embedded data field. Otherwise, be sure to add console.log(timeleft) in various places throughout your code above. For example, I tested with: Qualtrics.SurveyEngine.addOnload(function() { var timeleft = parseInt("${e://Field/TimeLeft})"); console.log(timeleft); var timer = setInterval(function () { if (timeleft <= 0) { clearInteval(timer); $('NextButton').click(); } timeleft--; }, 1000); $('NextButton').onclick = function (event) { Qualtrics.SurveyEngine.setEmbeddedData('TimeLeft', timeleft); console.log(timeleft); } }); In terms of moving to the end of the block, this code won't automatically do that. Are you trying to do this just for one questions, or o
So if I am following this thread correctly, 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.Su
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.