Changing first letter of piped text to lowercase | XM Community
Skip to main content
Solved

Changing first letter of piped text to lowercase

  • February 7, 2025
  • 11 replies
  • 214 views

Forum|alt.badge.img+1
  • Level 1 ●
  • 9 replies

I want to pipe the selection from a standard likert scale question like the one below into a follow-up open ended question.

  1. Very unlikely
  2. Somewhat unlikely
  3. Neither likely nor unlikely
  4. Somewhat likely
  5. Very likely

I want to change the first letter of the piped selection so that it is lower case.

The piping instruction I currently have in the open ended question is:
Why are you ${q://QID26/ChoiceGroup/SelectedChoices} to consider using... 

I tried using the tips noted in the thread below but it isn’t working for me.

 

Best answer by TomG

I think the html was lost from that post when the Community platform changed.

Use this html in your question text:

Why are you <span style="text-transform:lowercase">${q://QID26/ChoiceGroup/SelectedChoices}</span> to consider using... 

 

11 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6084 replies
  • Answer
  • February 8, 2025

I think the html was lost from that post when the Community platform changed.

Use this html in your question text:

Why are you <span style="text-transform:lowercase">${q://QID26/ChoiceGroup/SelectedChoices}</span> to consider using... 

 


Forum|alt.badge.img+1
  • Author
  • Level 1 ●
  • 9 replies
  • August 14, 2025

Is it possible to do this for all answer options except one? I have the list below and would like to pipe the selection into the middle of the subsequent question text. The lowercase transformation would apply to all options except the brand name which should stay capitalized.

  1. A plumber
  2. A contractor
  3. A water cleanup/drying service
  4. [BRAND]
  5. My insurance agent
  6. A friend or family member

Can I do this with html or do I need to set embed data to pipe instead?


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6084 replies
  • August 15, 2025

@Regan,

In your MC question, put [BRAND] inside a span with capitalize:

<span style='text-transform:capitalize'>[BRAND]</span>

When piped this span’s style will take precedence over the span with the lowercase style.


Forum|alt.badge.img+1
  • Author
  • Level 1 ●
  • 9 replies
  • August 22, 2025

Thanks, ​@TomG, this worked perfectly! I have a follow-up for the same question…

Answer choice 5 below doesn’t make sense when piped into the following question. To make sense the next needs to be “your insurance agent” when piped.

 

Q1  Which of the following best describes who you would contact first?

  1. A plumber
  2. A contractor
  3. A water cleanup/drying service
  4. [BRAND]
  5. My insurance agent OK HERE
  6. A friend or family member

 

Q2  Why would you contact ${q://QID9/ChoiceGroup/SelectedChoicesTextEntry} first? DOESN’T MAKE SENSE HERE; NEEDS TO BE “your insurance agent”

 

Is there a way to modify just this entry with JS and/or HTML? I would love to avoid creating embedded data fields since all the other options are working so well with tips you already provided.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6084 replies
  • August 22, 2025

Make the choice in Q1:

<span class="your">your</span> insurance agent

Add this JS to Q1:

Qualtrics.SurveyEngine.addOnload(function() {
this.getQuestionContainer().querySelector(".your").innerText = "My";
});

 


Forum|alt.badge.img+1
  • Author
  • Level 1 ●
  • 9 replies
  • August 22, 2025

Thank you SO much!


Forum|alt.badge.img+6
  • Level 2 ●●
  • 41 replies
  • October 15, 2025

What happens when the answer option has multiple uppercase characters and I only want to make the first letter lowercase? For example, ‘An IBM computer’ should be ‘an IBM computer’.  


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6084 replies
  • October 15, 2025

What happens when the answer option has multiple uppercase characters and I only want to make the first letter lowercase? For example, ‘An IBM computer’ should be ‘an IBM computer’.  

See my answer to ​@Regan’s question above. Put the ‘a’ in a span and change it to ‘A’ in the first question.

 


Forum|alt.badge.img+6
  • Level 2 ●●
  • 41 replies
  • October 15, 2025

What happens when the answer option has multiple uppercase characters and I only want to make the first letter lowercase? For example, ‘An IBM computer’ should be ‘an IBM computer’.  

See my answer to ​@Regan’s question above. Put the ‘a’ in a span and change it to ‘A’ in the first question.

 

Thanks. So if the first letter of the first word changes to any other letter, it would be a different span? 


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6084 replies
  • October 15, 2025

What happens when the answer option has multiple uppercase characters and I only want to make the first letter lowercase? For example, ‘An IBM computer’ should be ‘an IBM computer’.  

See my answer to ​@Regan’s question above. Put the ‘a’ in a span and change it to ‘A’ in the first question.

 

Thanks. So if the first letter of the first word changes to any other letter, it would be a different span? 

Difference spans yes, but they can all have the same class. Then have the JS change each occurrence to upper case. The JS would be slightly different:

Qualtrics.SurveyEngine.addOnload(function() {
this.getQuestionContainer().querySelectorAll(".fl").forEach(function(el) {
el.innerText = el.innerText.toUpperCase();
});
});

 


Forum|alt.badge.img+6
  • Level 2 ●●
  • 41 replies
  • October 15, 2025

What happens when the answer option has multiple uppercase characters and I only want to make the first letter lowercase? For example, ‘An IBM computer’ should be ‘an IBM computer’.  

See my answer to ​@Regan’s question above. Put the ‘a’ in a span and change it to ‘A’ in the first question.

 

Thanks. So if the first letter of the first word changes to any other letter, it would be a different span? 

Difference spans yes, but they can all have the same class. Then have the JS change each occurrence to upper case. The JS would be slightly different:

Qualtrics.SurveyEngine.addOnload(function() {
this.getQuestionContainer().querySelectorAll(".fl").forEach(function(el) {
el.innerText = el.innerText.toUpperCase();
});
});

 

Thanks!