Copy link to clipboard
Copied
I am trying to get my dropdowns to auto-fill with yellow when someone chooses "N" or No but do not like the harsh generic yellow. I have tried to research how to enter one of the other colors by using their RGB on a 0-1 scale. My question is where would I need to insert the RGB in my current script:
event.target.fillColor=(this.getField("Dropdown35").valueAsString=="N")? color.yellow:color.transparent;
And how should I enter it? All the forums I have read have =["RGB",value,value,value]
Thank you!
Copy link to clipboard
Copied
Just replace color.yellow with what you found, so something like this:
event.target.fillColor=(this.getField("Dropdown35").valueAsString=="N")? ["RGB",255/255,255/255,224/255] : color.transparent;
This will result in a light yellow color.
Copy link to clipboard
Copied
I am getting a Syntax error when I try that.
Copy link to clipboard
Copied
So I see you removed the word color. before the color calculations but now I have run into another problem. It highlights the box with every selection when I only want it to highlight when "N" is chosen. But the good news is the yellow is correct. Any thoughts on why it might be highlighting all the selections now just because I removed color.?
Copy link to clipboard
Copied
You can't use color.["RGB",255/255,255/255,224/255]
use only ["RGB",255/255,255/255,224/255].
Script should work fine, where did you use it? Did you check 'Commit selected value immediately' under dropdown field -> options tab?
Copy link to clipboard
Copied
I am kinda new to Adobe and very new to Java but I have the script under the "Calculate Tab" and in the "Custom Calculation Script". I tried checking the box you indicated in your message but no change. I have the right color yellow now but I just need it to be yellow when someone marks "N" and not all the time. It was working with the old yellow and when I had "color." in the script. Not sure what adjustment I need to make. Thank you for your help!
Copy link to clipboard
Copied
Post your code or share the actual file with us, please.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Seems fine to me. If it's not working share the file.
Copy link to clipboard
Copied
So it's working for me now. I decided to back out of the file and reopen it, working great. Again, thank you for your help
Copy link to clipboard
Copied
The last question, I have this set to change color when "N" is selected how do I indicate a color change in the same dropdown for a different selection. Some of my dropdowns have "N" and "Pending" that I would like both to change color for.
Copy link to clipboard
Copied
That requires a somewhat different construction of the code:
var s = this.getField("Dropdown35").valueAsString;
if (s=="N") event.target.fillColor=["RGB",255/255,255/255,224/255];
else if (s=="Pending") event.target.fillColor=["RGB",100/255,66/255,150/255];
else event.target.fillColor=color.transparent;