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

Trying to use conditional formatting to change text color based on field contents.

Community Beginner ,
May 07, 2019 May 07, 2019

New(ish) to creating fillable forms in Acrobat Pro.  I would like to have the text within a field change color based on the numeric value entered.  Through other posts, I've learned that I have to enter a java script in the validation field.  As I'm unfamiliar with java script, I'm not able to use the examples in these other posts to help...I'm not sure what I need to change to do what I want to do.  The field is named "Percentage" and if the value entered is greater than 15, I want the text to appear in red.  Help???

TOPICS
Acrobat SDK and JavaScript
750
Translate
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 , May 07, 2019 May 07, 2019

As the custom validation script of the field you can enter this code:

event.target.textColor = (event.value>15) ? color.red : color.black;

I assume that you want the text color to be black if it's not more than 15...

Translate
Community Expert ,
May 07, 2019 May 07, 2019

As the custom validation script of the field you can enter this code:

event.target.textColor = (event.value>15) ? color.red : color.black;

I assume that you want the text color to be black if it's not more than 15...

Translate
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
Community Beginner ,
May 07, 2019 May 07, 2019
LATEST

Thanks!!  That worked perfectly!

Translate
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