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

Need help with changing dropdown list fill color change

New Here ,
Oct 22, 2024 Oct 22, 2024

Hi, 

I am a serious beginner at JavaScript so have just been blundering about with finding situations and copy/pasting the solutions others have posted. I can't quite get this right because I thought I could merge a few different posts together to get an adequate solution to no avail.

 

I am creating a dropdown in which I have labeled "EH, H, M, L" which need to be fill color coded as Red, Orange, Yellow, Green, respectively. My issue is with the color orange, I can't seem to figure out how to make RGB values work in this script. I'm also not sure if there is an easier script to use given my ineptitude. Below is the validation script I have been using. Thanks for the help!

 

var f = this.getField("Dropdown18");

if(event.value == "EH"){
f.textColor = color.black;
f.strokeColor = color.red;
f.fillColor = color.red}

else if(event.value == "M"){
f.textColor = color.black;
f.strokeColor = color.yellow;
f.fillColor = color.yellow}

else if(event.value == "L"){
f.textColor = color.black;
f.strokeColor = color.green;
f.fillColor = color.green}

else if(event.value == "H"){
f.textColor = color.black;
f.strokeColor = color.["RGB", 255/255, 136/255, 0/255];
f.fillColor = color.["RGB", 255/255, 136/255, 0/255]}

TOPICS
How to
584
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Oct 22, 2024 Oct 22, 2024
LATEST

Remove color. when using RGB like this:

f.strokeColor = color.["RGB", 255/255, 136/255, 0/255];

should be:

f.strokeColor = ["RGB", 255/255, 136/255, 0/255];

 

Also, if the script is in the same dropdown where you wish to change colors, replace the first line with:

var f = event.target;

View solution in original post

Translate
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 22, 2024 Oct 22, 2024

is this an acrobat question?

Translate
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
New Here ,
Oct 22, 2024 Oct 22, 2024

Yes, sorry that I didn't clarify. I am attempting to do this on Adobe Acrobat Pro, Prepare a Form.

Translate
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
New Here ,
Oct 22, 2024 Oct 22, 2024

25C4C3EC-3667-4263-B160-AB23AE0D4751.jpeg

Translate
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 22, 2024 Oct 22, 2024

in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



<"moved from using the community">
Translate
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
New Here ,
Oct 22, 2024 Oct 22, 2024

Thank you

Translate
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 22, 2024 Oct 22, 2024
LATEST

Remove color. when using RGB like this:

f.strokeColor = color.["RGB", 255/255, 136/255, 0/255];

should be:

f.strokeColor = ["RGB", 255/255, 136/255, 0/255];

 

Also, if the script is in the same dropdown where you wish to change colors, replace the first line with:

var f = event.target;

Translate
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