Copy link to clipboard
Copied
i have a form that i want to place several boxes to fill with either red, yellow or green. i want to be able to place a list box or dropdown box in a rectangle and if i select red from the list i want the box to fill red with red font so it just looks like a filled in red box. likewise for yellow and green
Copy link to clipboard
Copied
It's hard to help without knowing actual field names and how many are there, that photo doesn't help anything.
When ask for help, try to include all information.
Here is a basic script how to change border and text color of a text field depending on dropdown selection, just change "Text Field" to your actual text field name and use script as 'Validate' script of dropdown field:
var f = this.getField("Text Field");
if(event.value == "Red"){
f.textColor = color.red;
f.strokeColor = color.red;}
else if(event.value == "Yellow"){
f.textColor = color.yellow;
f.strokeColor = color.yellow;}
else if(event.value == "Green"){
f.textColor = color.green;
f.strokeColor = color.green;}
else{
f.textColor = color.black;
f.strokeColor = color.black;}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
i changed the script a bit and I think it works
var f = this.getField("Dropdown1");
if(event.value == "red"){
f.textColor = color.red;
f.strokeColor = color.red;
f.fillColor = color.red}
else if(event.value == "yellow"){
f.textColor = color.yellow;
f.strokeColor = color.yellow;
f.fillColor = color.yellow}
else if(event.value == "green"){
f.textColor = color.green;
f.strokeColor = color.green;
f.fillColor = color.green}
else if(event.value == "white"){
f.textColor = color.white;
f.strokeColor = color.white;
f.fillColor = color.white}
Copy link to clipboard
Copied
another update... it doesn't work on adobe acrobat reader on my ipad, only on desktop. anybody help for that? that is primarily where i would want to use it, in the field.
Copy link to clipboard
Copied
another update... adobe mobile doesn't recognize scripts i guess??? downloaded pdf expert to open file and can make color selections on free version but cannot comment when needed. will probably purchase editing feature unless adobe gets it act together to read scripts created in its own desktop app. smh
Copy link to clipboard
Copied
Different PDF viewers have differnt levels of compliance with the Acrobat JavaScript model.
The desktop Acrobat Pro and Rearder, as well as some of the better 3rd Party PDF viewers, have the highest level of compliance. The Acrobat mobile viewer has less. It only provides support for basic calcualtions and some list handling. PDF Expert is better than Acrobat mobile. But all others such as the browser viewers, or just about any mobile viewer have very poor, or zero, compliance.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more