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

Change the form field background color based on value entered

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

Views

2.6K

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

In the preferences of Adobe Acrobat disable the form highlighting.

Votes

Translate

Translate
Enthusiast ,
Oct 03, 2020 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.

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

Copy link to clipboard

Copied

In the preferences of Adobe Acrobat disable the form highlighting.

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

Copy link to clipboard

Copied

LATEST

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.

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