I have an embedded data field in my question as shown below.
This was the value from using the Insert Embedded Data option and writing caption1, I also tried ${e://Field/caption1} but got the same empty result.
Within the JavaScript for my question, I have the following code
Qualtrics.SurveyEngine.addOnload(function(){
Qualtrics.SurveyEngine.setEmbeddedData( 'caption1', "a" );
});
However, when I preview the page the embedded field is not shown. How can I change my JavaScript to get the embedded data to appear?
You can't pipe embedded fields on the same page you set them. The the pipes are resolved before the JS runs.
When you insert embedded data, just enter the field name, not the pipe. When you enter the pipe you get the encoded version of a pipe within a pipe: ${e://Field/${e://Field/caption1}}
I see, so should I be entering caption1? That just displays the text caption1
The correct pipe is ${e://Field/caption1}, just type it directly where you want it piped.
Just tried that pipe, but it's still not appearing
Please note my first comment.
My apologies, if it is not possible to pipe embedded fields on the same page they are set in, what is the workaround for inserting the embedded data?
https://community.qualtrics.com/XMcommunity/discussion/comment/55337#Comment_55337If you are looking to calculate or populate a dynamic value and display it, you'll need to use JS to update an HTML element.
Good to know, thank you! Do you know what syntax I should be using for the HTML element (or any resources that I can use to find this out)?
https://community.qualtrics.com/XMcommunity/discussion/comment/55344#Comment_55344HTML:
JS:
jQuery("#caption1").html(caption1var);
That did exactly what I wanted, thank you so much!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.