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

Want Dropdown Selection to Trigger Color Change

Community Beginner ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

Rusty Java user here. Thanks in advance for the help!

 

In the form below, I need the user's selection from the drop down menu (Dropdown12)  in the Status column (selections are Green, Yellow, Red, N/A) to color that box the corresponding color. I'm running this script as a custom validation script in the Validate tab. I have the "Commit selected value immediately" box checked on the Options tab. 

 

This script turns the dropdown menu background to the correct color (except for black which isn't doing anything), but does not turn the box itself a color. Is what I'm trying to do available in Acrobat?

 

Thank you!

 

if (event.value=="Green")event.target.fillColor=color.green;

else if (event.value=="Yellow")event.target.fillColor=color.yellow;

else if (event.value=="Red") event.target.fillColor=red;

else if (event.value=="N/A") event.target.fillColor==black;

 

------------------

Status Screen Shot.jpg

TOPICS
How to , JavaScript , PDF forms

Views

244

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 ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

Add color.before red and black:
color.red and color.black
And remove one equal sign when setting color black:
event.target.fillColor==black;

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 ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

Thank you for correcting that! I made the change, but the only color change is still the drop down menu background when the selection is made. Their choice in the column remains in black text on the blue background. And, curiously, when the user now clicks on the other cells in the first row, the color of the cell turns from blue to red.

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 ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

You must disable the fields highlighting to see the fill color of the fields.

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 ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

That was helpful, thank you very much! However, the row is now red no matter what color option I select in the Status row.

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 ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

Sorry, in the Status Column, not row.

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 ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

Post the script you used or share the file if you can.

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 ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

Thank you!

 

if (event.value=="Green")event.target.fillColor=color.green;

else if (event.value=="Yellow")event.target.fillColor=color.yellow;

else if (event.value=="Red") event.target.fillColor=color.red;

else if (event.value=="N/A") event.target.fillColor=color.black;

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 ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

The code is fine. Share the file if it's not working.

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 ,
Feb 03, 2025 Feb 03, 2025

Copy link to clipboard

Copied

 

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 ,
Feb 03, 2025 Feb 03, 2025

Copy link to clipboard

Copied

Works fine for me.

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 ,
Feb 03, 2025 Feb 03, 2025

Copy link to clipboard

Copied

It doesn't work for the other 10 people who have tried it.

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 ,
Feb 03, 2025 Feb 03, 2025

Copy link to clipboard

Copied

Where did they try it? In what application?

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 ,
Feb 03, 2025 Feb 03, 2025

Copy link to clipboard

Copied

Hi. We're all opening it in Acrobat. The users are selecting an option in the Status column. That dropdown menu turns the selected color and upon exit the field color disappears.

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 ,
Feb 03, 2025 Feb 03, 2025

Copy link to clipboard

Copied

Did you disable the fields highlighting, as I've instructed above?

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 ,
Feb 04, 2025 Feb 04, 2025

Copy link to clipboard

Copied

If you're talking about Apperance in the Dropdown Properties the fill color is set to nothing. Is there somewhere else this is changed? I also have "Commit Selected Value Immediately" selected on the Options tab in the Drowndown Properties.

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 ,
Feb 04, 2025 Feb 04, 2025

Copy link to clipboard

Copied

You can turn it off under Preferences ⇾ Forms ⇾ Show border hover color for fields.

Every user needs to do it on their computer.

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 ,
Feb 04, 2025 Feb 04, 2025

Copy link to clipboard

Copied

Holy crow, I had NO idea a global preference like that needed to be adjusted, and for every user! It works! Thank you SO incredibly much. This was driving me bonkers. I appreciate you sharing your expertise and helping me accomplish this task, Nesa. Thank you! 

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 ,
Feb 04, 2025 Feb 04, 2025

Copy link to clipboard

Copied

You're welcome...

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 ,
Feb 04, 2025 Feb 04, 2025

Copy link to clipboard

Copied

LATEST

I really appreciate your help! 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