Greetings all, I have a question I'm helping someone can help me with. I have a survey which we are using to register people. The survey asks a number of questions and these are then all injected into the Directory (I'm a iQ Directory user) as embedded data fields in a contact list trigger.
The problem I'm running into is that in a multiple choice question I have an answer and then some text after it. The answer is bolded to set it off from the e.g. text that follows it. So it looks like this: "Answer1 (e.g. example1, example2)"
Now the contact list trigger says to send "Selected choices" from that question into an embedded data field in the Directory. But when I visit the Direcotry, the embedded data field for the example above would read: "`<strong>Answer1</strong> (e.g. example1, example2)`"
So is there any way to get Qualtrics to *not* include the HTML formatting tags when it injects the "Selected Choices" into the embedded data field and then into the Directory via the contact list trigger? Or do I just have to remove the bolding if I dont want a bunch of strong tags around all my participants' answers?
Page 1 / 1
The HTML tags will appear automatically as you have given in questions... You have to manually delete them if y want.
Hello @ironspider ,
If you bold your answer choice text at survey runtime using js then HTML tag won't appear in the contact list.
Paste the below code in js(onReady) of multichoice question to bold your answer choice (This will bold your full answer text, to bold part of text we need to have some different code )
`jQuery("#"+this.questionId+" .LabelWrapper Label span").css("font-weight","Bold");`
OR if your options syantax are exactly like this `Answer1 (e.g. example1, example2)`, then use the below code to bold the part of the text i.e Answer1
jQuery("#"+this.questionId+" .LabelWrapper Label").each(function(){
jQuery(this).html("<strong>" + jQuery(this).text().substring(0,jQuery(this).text().indexOf('(')-1) + "</strong>" + jQuery(this).text().substring(jQuery(this).text().indexOf('(')));
});
If you bold your answer choice text at survey runtime using js then HTML tag won't appear in the contact list.
Paste the below code in js(onReady) of multichoice question to bold your answer choice (This will bold your full answer text, to bold part of text we need to have some different code )
`jQuery("#"+this.questionId+" .LabelWrapper Label span").css("font-weight","Bold");`
OR if your options syantax are exactly like this `Answer1 (e.g. example1, example2)`, then use the below code to bold the part of the text i.e Answer1
jQuery("#"+this.questionId+" .LabelWrapper Label").each(function(){
jQuery(this).html("<strong>" + jQuery(this).text().substring(0,jQuery(this).text().indexOf('(')-1) + "</strong>" + jQuery(this).text().substring(jQuery(this).text().indexOf('(')));
});
@ironspider,
It is a matter of preference, but an alternative to @Shashi 's approach of adding styling on the fly is to remove it before the end of survey. So in a question before end of survey:
```
Qualtrics.SurveyEngine.addOnload(function() {
Qualtrics.SurveyEngine.setEmbeddedData("Q1answer", jQuery("<span>${q://QID1/ChoiceGroup/SelectedChoices}</span>").text());
});
```
Then save embedded data Q1answer in your Contact Trigger instead of the question.
It is a matter of preference, but an alternative to @Shashi 's approach of adding styling on the fly is to remove it before the end of survey. So in a question before end of survey:
```
Qualtrics.SurveyEngine.addOnload(function() {
Qualtrics.SurveyEngine.setEmbeddedData("Q1answer", jQuery("<span>${q://QID1/ChoiceGroup/SelectedChoices}</span>").text());
});
```
Then save embedded data Q1answer in your Contact Trigger instead of the question.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.