简体   繁体   中英

Conditional Formatting Color fill in Adobe Acrobat DC

在此处输入图像描述 I am trying to conditionally format a field in my PDF to fill with a certain color based on the selected dropdown list's value. It seems i have gotten some traction, but the only color that works is red, and it does not change colors if I select a different value from my dropdown. I need help with my Javascript. Here is what I have so far:

var v = this.getField("Dropdown4.4").value;
if (v="Business Now") {event.target.fillColor = color.green;}
if (v="Business Future") {event.target.fillColor = color.blue;}
if (v="Daily To-Do's") {event.target.fillColor = color.red;}                    
if (v="Marketing") {event.target.fillColor = color.orange;}
if (v="Learning Plan") {event.target.fillColor = color.yellow;}

Put the same script into a custom format script. The format script runs after the value has been committed but before the field loses focus. In the mouse up event, the value hasn't actually changed yet.

What happens when you change

var v = this.getField("Dropdown4.4").value ;

to

var v = event.target.value ;

Also, instead of a series of if()… statements, you might also use the switch()… statement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM