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

Community Beginner ,
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???

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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

TOPICS
Acrobat SDK and JavaScript

Views

181

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

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

Community Beginner ,
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???

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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

TOPICS
Acrobat SDK and JavaScript

Views

182

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
May 07, 2019 0
Most Valuable Participant ,
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...

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
Reply
Loading...
May 07, 2019 3
KristiD5 LATEST
Community Beginner ,
May 07, 2019

Copy link to clipboard

Copied

Thanks!!  That worked perfectly!

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
Reply
Loading...
May 07, 2019 0