• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Conditional Formatting with a special character

New Here ,
Sep 21, 2021 Sep 21, 2021

Copy link to clipboard

Copied

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?  

TOPICS
Acrobat SDK and JavaScript

Views

42

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 21, 2021 Sep 21, 2021

Replace:

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

With:

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

Likes

Translate

Translate
Community Expert ,
Sep 21, 2021 Sep 21, 2021

Copy link to clipboard

Copied

Replace:

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

With:

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 27, 2021 Sep 27, 2021

Copy link to clipboard

Copied

LATEST

Thank you so much for your help.  It works!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines