I'm new to Qualtrics, I wanted to save the data in qualtrics from custom javascript code. can anyone tell me how to do that ?
Thanks,
Abhi
Best answer by Michael_Campbell_RedPepper
View originalBest answer by Michael_Campbell_RedPepper
View originalHi everyone! I'm also in a similar position. I'm using Qualtrics to record feedback data. However, I also want to record some metadata (
groupId) around this. I'm passing the metadata through JavaScript according to the documentations mentioned. Below is my HTML code snippet:
addOnloadmethod. However, on my server, it says
Uncaught ReferenceError: Qualtrics is not defined. Isn't the script supposed to define Qualtrics on its own? Could anyone point out what I'm missing here? Thanks!
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.SurveyEngine.setEmbeddedData('FIELD', value);`
`Qualtrics.SurveyEngine.getEmbeddedData('FIELD');`
});
Is this correct?
I have a series of questions that I want to capture the embedded data. Do I need a embed data block before each question or just one embed data block at the start of the series
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.