Skip to main content
Participant
Sep 21, 2021 9:05 PM UTC
Answered

Conditional Formatting with a special character

Hi,

I am trying to highlight form fields in a pdf if the data in the field contains an asterisk before the number, for example "*8.596" may be in the field.  I have searched through multiple threads in this community and feel like maybe I am close, but it is not working.  With the asterisk being a special character, I added the backspace.I am not getting an error, it is just not highlighting the field.  Right now I am using this:

if (event.value=="\**") event.target.fillColor = color.yellow;
else event.target.fillColor = color.transparent;

Any suggestions on what I am doing wrong?  

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Sep 21, 2021 9:11 PM UTC

Replace:

(event.value=="\**")

With:

(/^\*/.test(event.value))

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Sep 21, 2021 9:11 PM UTC

Replace:

(event.value=="\**")

With:

(/^\*/.test(event.value))

Translate
Participant
Sep 27, 2021 4:14 PM UTC

Thank you so much for your help.  It works!

Translate