Formatting embedded data to make it all lowercase | XM Community
Skip to main content
Solved

Formatting embedded data to make it all lowercase

  • March 21, 2019
  • 6 replies
  • 433 views

Forum|alt.badge.img+1
Hello, I created embedded data based on the answer to the multiple-choice question. Let's say the question looks like this: Which color is your favorite? 1. Red 2. Blue 3. Green And I recorded the answer as "color". Then, I want to use "color" in the survey like: You choose ${e://Field/color} color for your favorite. Currently, the result looks like: "You choose Green color for your favorite." But I want to change the format of "Green" to "green", making all characters lowercase. Is it possible to do it? Thank you very much in advance.

Best answer by TomG

> @jhwang said: > @TomG, > Thank you for the clarification. Now I use this html for my question: > > `You choose <span class="color">${e://Field/color}</span>.` > > And JS is like: > Qualtrics.SurveyEngine.addOnload(function() { > jQuery("span.color").html("${e://Field/color}".toLowerCase()); > }); > > And the result is: > You choose green. > > But if I want to make "green" bold, like: > You choose green. > > Is it possible to set two styles (lowercase and bold)? Change the style of the span: ``` <span class="color" style="font-weight:bold">${e://Field/color}</span> ```

6 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • March 21, 2019
Use JavaScript: ``` "${e://Field/color}".toLowerCase(); ```

Forum|alt.badge.img+1
  • Author
  • March 21, 2019
@TomG, Thanks for your answer. Do you mean using Java, like as follows on the page that I used the embedded data? Qualtrics.SurveyEngine.addOnload(function() { "${e://Field/color}".toLowerCase(); });

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • March 21, 2019
> @jhwang said: > @TomG, > Thanks for your answer. Do you mean using Java, like as follows on the page that I used the embedded data? > > Qualtrics.SurveyEngine.addOnload(function() > { > "${e://Field/color}".toLowerCase(); > }); That's JavaScript (Java is a different language that isn't used in Qualtrics). You've got the basic idea, but the script isn't correct. The specific script would depend on what question you are attaching the script to. Let's say it is the question where you want to pipe color, and your question html is: ``` You choose <span class="color"></span> color for your favorite. ``` Then your JS would be: ``` Qualtrics.SurveyEngine.addOnload(function() { jQuery("span.color").html("${e://Field/color}".toLowerCase()); }); ```

Forum|alt.badge.img+1
  • Author
  • March 21, 2019
@TomG, Thank you for the clarification. Now I use this html for my question: `You choose <span class="color">${e://Field/color}</span>.` And JS is like: Qualtrics.SurveyEngine.addOnload(function() { jQuery("span.color").html("${e://Field/color}".toLowerCase()); }); And the result is: You choose green. But if I want to make "green" bold, like: You choose green. Is it possible to set two styles (lowercase and bold)?

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • March 21, 2019
> @jhwang said: > @TomG, > Thank you for the clarification. Now I use this html for my question: > > `You choose <span class="color">${e://Field/color}</span>.` > > And JS is like: > Qualtrics.SurveyEngine.addOnload(function() { > jQuery("span.color").html("${e://Field/color}".toLowerCase()); > }); > > And the result is: > You choose green. > > But if I want to make "green" bold, like: > You choose green. > > Is it possible to set two styles (lowercase and bold)? Change the style of the span: ``` <span class="color" style="font-weight:bold">${e://Field/color}</span> ```

Forum|alt.badge.img+1
  • Author
  • March 21, 2019
@TomG, Great! It works perfectly. Thank you very much for your help!