Skip to main content
Participant
April 22, 2020
Question

Event.Value formatting in calculated field

  • April 22, 2020
  • 1 reply
  • 1995 views

Greetings all,

 

I looked through the forums but could not find an answer to the issue I face.

I have a text field populate based on an option selected from a drop down list using event.value.

 

If I have the following code: else if (selection=="Package C") event.value = "Package C includes: X, Y, and Z";

 

Is there a way to bold only "Package C includes"? 

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
April 22, 2020

Yes, but it requires a more complex script. First of all you need to change the properties of the text field so that it uses Rich Text Formatting. Then change your code to the following:

 

else if (selection=="Package C") event.richValue = [{text: "Package C includes", fontWeight: 800}, {text: ": X, Y, and Z"}];

 

Edit: Small mistake fixed in the code. Use current version.

Known Participant
November 16, 2021

Thanks, that worked perfectly well. Is there any way to add line break between Bold and non-bold Text?

try67
Community Expert
Community Expert
November 16, 2021

Yes, add "\n" to the end of the first string, or the start of the second one.