Highlighted

Change the form field background color based on value entered

New Here ,
Oct 03, 2020

Copy link to clipboard

Copied

Hi, everyone. I've tried this code both in "Custom Format Script" and "Custom Validation Script" but it shows the desired background color as long as the cursor is inside the text field. When I click anywhere, the background goes away. The code I'm using from this forum is

var v = Number(event.value);
if (v>=0 && v<=26) {event.target.fillColor = color.green;}
else if (v>26 && v<=50) {event.target.fillColor = color.yellow;}
else if (v>50 && v<=60) {event.target.fillColor = color.red;}
else event.target.fillColor = color.white;

I have tried many other codes from the forum having different techniques of performing the same function, but other codes do not even show the color.

I'm using Adobe Acrobat Pro DC Version 2020.012.20048.

Can you please help me to get this worked?

Regards

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

In the preferences of Adobe Acrobat disable the form highlighting.

Views

81

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

Change the form field background color based on value entered

New Here ,
Oct 03, 2020

Copy link to clipboard

Copied

Hi, everyone. I've tried this code both in "Custom Format Script" and "Custom Validation Script" but it shows the desired background color as long as the cursor is inside the text field. When I click anywhere, the background goes away. The code I'm using from this forum is

var v = Number(event.value);
if (v>=0 && v<=26) {event.target.fillColor = color.green;}
else if (v>26 && v<=50) {event.target.fillColor = color.yellow;}
else if (v>50 && v<=60) {event.target.fillColor = color.red;}
else event.target.fillColor = color.white;

I have tried many other codes from the forum having different techniques of performing the same function, but other codes do not even show the color.

I'm using Adobe Acrobat Pro DC Version 2020.012.20048.

Can you please help me to get this worked?

Regards

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

In the preferences of Adobe Acrobat disable the form highlighting.

Views

82

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
Oct 03, 2020 0
Contributor ,
Oct 03, 2020

Copy link to clipboard

Copied

Code is fine if , it must be something else going on in your file.Try sharing your file here.

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...
Oct 03, 2020 0
Adobe Community Professional ,
Oct 04, 2020

Copy link to clipboard

Copied

In the preferences of Adobe Acrobat disable the form highlighting.

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...
Oct 04, 2020 1
New Here ,
Oct 04, 2020

Copy link to clipboard

Copied

Thank you. It solved my problem. I was wondering why my own codes as well as codes from the forum are not working. Thanks again.

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...
Oct 04, 2020 0