Copy link to clipboard
Copied
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]}
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
is this an acrobat question?
Copy link to clipboard
Copied
Yes, sorry that I didn't clarify. I am attempting to do this on Adobe Acrobat Pro, Prepare a Form.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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">
Copy link to clipboard
Copied
Thank you
Copy link to clipboard
Copied
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;
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more