Is there a way to display a % sign in the piped text? | XM Community
Question

Is there a way to display a % sign in the piped text?

  • 26 June 2020
  • 1 reply
  • 12 views

For example, the initial question that we have is:
"Of the  justice-involved people your agency served, what percentage received any treatment for depression anywhere in the county in the last year?
There are two text box answer choices, one where the respondent can type in the "number" and one where they can type in the "percentage" if they do not know the number. When this enters into the subsequent questions, it looks like:
"Of the (PIPED TEXT)  justice-involved individuals who received treatment for depression anywhere in the county, how many received selective serotonin reuptake inhibitors for depression in the last year?"
The problem is that when they enter a percentage, the subsequent question does not show "percentage." For instance, if their answer was 30%, the subsequent question reads, "Of the 30 justice-involved individuals" rather than "Of the 30% justice-involved individuals..." Is there a way to have the "$ of the" show up automatically if they answer in the "percentage" text box without having to make completely different questions to trigger with this text?
THANK YOU!!



1 reply

Userlevel 5
Badge +4

You can simply add the % in one of the span and based on the selection at the previous question you can show or hide the symbol.
%
Initially make this as hidden and based on the previous answer just make this symbol visible along with the number of percentage entered in the previous question.
jQuery(".percent").css("display","none")

var percentval = "${previous question percentage value}"
if(percentval !='' || percentval >0){jQuery(".percent").css("display","inline")}

Leave a Reply