Javascript-populated question data not appearing in responses | XM Community
Question

Javascript-populated question data not appearing in responses

  • 29 August 2019
  • 5 replies
  • 60 views

Hi,

I am quite good with Javascript, but very new to Qualtrics. I have created a question in Qualtrics with much of the data populated through functions in Javascript. However, none of the dynamically populated data seems to come through into the responses data. The dynamic content appears perfectly when taking the survey, but is then stripped out of the response data, just giving the bare HTML template.

Is there something simple that I am missing?

Cheers

5 replies

Userlevel 7
Badge +23
Have you added the variables in the Survey flow?
Hi,

I have read about this approach in a few places, but don't think it will help me.

Basically, I am generating quite a bit of custom HTML through JavaScript, mainly because I need to do a lot of randomisation and loop iteration to generate dynamic content in the HTML question.

My guess is that if I was to add the variables in Survey Flow (which I still can't figure out how to do anyway), Qualtrics would simply pull through the raw HTML which is generated by the JavaScript iterators, and not apply CSS or anything like that.

Some guidance would be great however on how I can try the Survey Flow approach. So far, I cannot figure out how to flag up variables I have created in JavaScript.
Userlevel 7
Badge +6
@jlognn - Why don't you describe what you are trying to do with dynamic content and loop variation. You might be able to do all this in Qualtrics without much JavaScript.
Userlevel 7
Badge +27
@jlognn,

Qualtrics doesn't save response data it doesn't know about. So, your JavaScript has to save the data to an Qualtrics question or to an embedded data field that is defined in the survey flow. To save a JavaScript variable as an embedded data field, use the setEmbeddedData function:
```
Qualtrics.SurveyEngine.setEmbeddedData("EmbeddedDataFieldName", jsVar);
```

jlognn Were you able to solve this? I am in a similar boat: https://www.qualtrics.com/community/discussion/15942/input-fields-created-using-js-not-showing-up-in-report/p1?new=1

Leave a Reply