How to set embedded data using javascript? | XM Community
Solved

How to set embedded data using javascript?

  • 3 January 2022
  • 2 replies
  • 3411 views

Badge +1

Hi I have set up a questionnaire with 2 questions as follows:
image.pngQ1 contains some javascript:
Qualtrics.SurveyEngine.addOnload(function()
{
response.setContentType("text/plain");
Qualtrics.SurveyEngine.setEmbeddedData( 'caption1', "a" );
Qualtrics.SurveyEngine.setEmbeddedData( 'caption2', "b" );
Qualtrics.SurveyEngine.setEmbeddedData( 'caption3', "c" );
Qualtrics.SurveyEngine.setEmbeddedData( 'caption4', "d" );
});

that is supposed to allocate values to embedded data that then gets reused in Q2.
My flow is as follows:
image.pngHowever, this does not work and displays the following:
image.png
Can someone throw some light as to what I am doing wrong?

icon

Best answer by ahmedA 4 January 2022, 00:56

View original

2 replies

Userlevel 7
Badge +21

Delete this line response.setContentType("text/plain")

Badge +1

https://community.qualtrics.com/XMcommunity/discussion/comment/42640#Comment_42640Thanks AhmedA, that works a treat! Solved me untold headaches!

Leave a Reply