Change font colors with a calculation in Survery123

03-14-2019 07:09 AM
Occasional Contributor

Hi everyone,

I'm just wondering if it's possible to change a fields font or background color in Survey123 based on a calculation. I have a form where we have a lot of stability calculations, I'd like to change the background or text color if the values entered in the form are within a certain range. Right now I have calculated fields that indicate if the values are within range, which works well enough, I'd just like to simplify the form.

Tags (1)
2 Replies
Esri Regular Contributor

Hi Grant,

This could be possible by specifying something like the following in the calculation column...

concat('<font color="', if(selected(${example}, 'red'), "red", ""),'">Text in changes color </font>')

select_one colorexampleExample
notediffctestconcat('<font color="', if(selected(${example}, 'red'), "red", ""),'">Text in changes color </font>')

This will lead to the font color of the label changing to red if red is selected in the previous question, or, remain the default color in the event that nothing or something else is selected.

I have also included the XLSForm as an attachment to this thread, which contains this example.



New Contributor III

Hey Brandon, I was wondering if it were possible to us a if statement after a calculation to color code based of a numeric threshold? I have a note field that is a numeric calculation, I would like the number calculated to show up red if the number is below 3.0. I cant seem to get a statement to work.

0 Kudos