Copy link to clipboard
Copied
if (event.value=="VD")
event.target.fillColor = color.gray;
else if (event.value=="OD")
event.target.fillColor = color.ltGray;
else event.target.fillColor = color.transparent;
Copy link to clipboard
Copied
Put the code in a doc-level function and then use a script to set the Validation action of the fields to call that function.
Copy link to clipboard
Copied
Thanks! I guess I need more than that. How do I "Put the code in a doc-level function and then use a script to set the Validation action of the fields to call that function."
Copy link to clipboard
Copied
Do you want to apply this code to all drop-downs in your file, or just some?
Copy link to clipboard
Copied
Well, just some I guess. There are alot of drop downs. There are 360 drop downs for this specific questions. Basically what I want it to do is this...
The room# is typed in, there are two options for the status, "VD" and "OD", and final is blank.
Lets say the room number is 400, I want the status to be VD. When I choose VD the background will change to gray. I also want the room number to change to gray as well. If I choose OD it will change to ltGray.
Hopefully that makes sense.
Copy link to clipboard
Copied
Go to Tools - JavaScript - Document JavaScripts. Create a new item (you can call it "scripts"), and paste this code into it:
function validateDropdown() {
if (event.value=="VD")
event.target.fillColor = color.gray;
else if (event.value=="OD")
event.target.fillColor = color.ltGray;
else event.target.fillColor = color.transparent;
}
Then execute this code from the JS Console (adjust the first line to contain the names of the fields you want to have this validation script):
var dropdowns = ["Status1", "Status2", "Status3"]; //etc.
for (var i in dropdowns) {
this.getField(dropdowns).setAction("Validate", "validateDropdown();");
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now