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

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

Community Beginner ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

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

Views

526

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 , 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...

Votes

Translate

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

Copy link to clipboard

Copied

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...

Votes

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

Copy link to clipboard

Copied

LATEST

Thanks!!  That worked perfectly!

Votes

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