Hello, I tried to set up some conditional formating on a PDF form and am hot sure where it went wrong. Here's what I hoped to achieve: I configured three check-box field "Check Box220.127.116.11", "Check Box5.1.0", and "Check Box18.104.22.168", and I want the three box to be filled with green, red, and purple if they're checked individually.
if(event.target.value != "Off")
this.getField("Check Box22.214.171.124").fillColor = color.yellow;
this.getField("Check Box126.96.36.199").fillColor = color.transparent;
I edited the form on MacOS and it seems to be working, but when I later open it up on a PC, it behaves really strange. Same thing happened when I opened it on a differnet Mac. Once I checked another box, it'll clear up the color for the previous check-box. Not sure where I got it wrong. Thanks!
What software you use on PC?
Did you work in preview mode on your Mac?
All machines are using the latest version of Acrobat Pro.
Can you clarify what do you mean in preview mode? I'm not using the Preview app that comes with MacOS, that video is taken on a PC.
Could you share your file here so we can take a look?
It works fine for me.
Do you have any other scripts in your file?
Try using script like this:
event.target.fillColor = event.target.value == "Off" ? color.transparent : color.red;
Turns out it's an issue with disabling fields highlighting so the filled color will show when the check box is not being selected. But thanks for the code. It definitely made my life easiler configuing all those individual check boxes.
You have to disable fields highlighting in order to see the fill color of the fields when they are not in focus.
That's it!!!! I added a document script to disable highlighting and it works like magic! Thank you so much!