I'm using JS to store embedded data (code below). It seems to work, as I am able to embed the data in the survey. However, when I export the survey responses the embedded data variable is empty. I created a variable in the survey flow before the JS code was applied (attached as an image), but it still doesn't work. Any idea what I'm doing wrong?
Here is the code:
Qualtrics.SurveyEngine.addOnload(function()
{
jQuery('.QuestionOuter').css('display','none')
var firstName = "${e://Field/firstName}";
});
Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery('input[type="checkbox"]').prop('checked',true);
var qid= this.questionId;
Qualtrics.SurveyEngine.setEmbeddedData('firstName',String(jQuery('#'+qid).find('.Selection').eq(0).text()));
jQuery('#NextButton').click();
});
Here is how I created the embedded data variable:
Strange - looks like it wasn't working when I used qualtrics' generated responses. However, when I responded myself it did record the randomization.
https://www.qualtrics.com/community/discussion/comment/27472#Comment_27472Okay, so java script does not work when generating test responses.
The script doesn't have any issue LOB , if you want to check the embedded data value in the middle of testing/in the link you can check in console, use the below code to check if the correct data is getting stored in embedded data.
Qualtrics.SurveyEngine.getEmbeddedData('firstName')
So there is no way that I can record the embeddedData from a JS code with test responses? I would need to do that to test if my JS code works, e.g. if it randomizes correctly. I understand that I can use the console and that I could enter my own responses (then it is recorded), or test the JS separately and independent from Qualtrics, but this is not what I need. Any ideas?
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.