Modifying Piped Text | XM Community
Skip to main content

Hello,
I am trying to modify the piped text that is derived from a previous question's options. Instead of including each choice's entire text which contains a description, I would like to have a shortened version in the subsequent question. For example, if a respondent selects 'Artist/musician who performs in venues (or wishes to perform in venues)', how can I make it appear as 'Artist' in the piped text?
This is what the piped text currently looks like:

 ${q://QID1/ChoiceGroup/SelectedChoices}



piped text source.PNGpiped text.PNGThanks in advance for your help!

Put the description part in a span tag with a class and hide it. Then in your initial question use JS to show the description. Anywhere else you pipe it, it will be hidden.
html:
Artist
JS:
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" .description").show();
});


TomG thanks for the suggestion -- where does the html string get inputted?


https://community.qualtrics.com/XMcommunity/discussion/comment/45166#Comment_45166In your choice text on the initial question.


Hi TomG, unfortunately the HTML isn't working when I insert it using the Rich Content Editor. Are you able to show what it should look like in the survey editor?


https://community.qualtrics.com/XMcommunity/discussion/comment/45336#Comment_45336It would look like this when you edit the choice:
image.pngand this when you aren't editing:
image.png


TomG the JS is not working. Have tried multiple times and made sure to publish. Number and qid all correct. Any suggestions?
Current code
Qualtrics.SurveyEngine.addOnload(function()
{
jQuery("q11.1_1"+this.qid32+".description").show();

});


https://community.qualtrics.com/XMcommunity/discussion/comment/48452#Comment_48452The code should be:
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" .description").show();
});
'this' is the current question. this.questionId is the question id of the current question (e.g., QID32). So, it is the equivalent of

jQuery("#QID32 .description")
without having to hard code the question id.


thank you TomG I actually had the code correct when I first tried and doesn't show full description. I've copied and pasted directly from here, added it to addOnload in the JS for the question but nothing.
thank you for the explanation of 'this'!


TomG the initial part works beautifully.
Screen Shot 2022-08-12 at 2.07.37 PM.png
Screen Shot 2022-08-12 at 2.07.49 PM.png


TomG FYI the following worked:
image.pngNot sure why the other JS didn't but I appreciate your help!


https://community.qualtrics.com/XMcommunity/discussion/comment/48552#Comment_48552The element with the class "description" must be in a different question than the question the JS is attached to.


Leave a Reply