Skip to main content
Known Participant
Jul 3, 2025 1:51 PM UTC
Answered

Change border if checkbox is checked

I have a button called Button1 and a checkbox called Checkbox1.  Button1 currently has a red thin border.  If Checkbox1 is checked, I would like the border to change to green medium.  Is this possible?

PDF Automation Station
Community Expert
Jul 4, 2025 1:47 AM UTC

One more thing.  Is it possible to change the border color and the fill color if a button if text is entered in a text field.  Example, if text is entered in Text Field1, can the border color and the fill color of Button1 be changed from red to green?


Enter the following custom calculation script in the text field:

if(event.value)

{

//Your script if the text field contains a value

}

else

{

//Your script if the text field does not contain a value

}

7 replies

PDF Automation Station
Community Expert
Community Expert
Jul 3, 2025 2:36 PM UTC

Enter the following Mouse Up action script in the check box:

var oFld=this.getField("Button1");
if(event.target.value=="Off")
{
oFld.borderColor=color.red;
oFld.lineWidth=1;
}
else
{
oFld.borderColor=color.green;
oFld.lineWidth=2;
}
Translate
Known Participant
Jul 3, 2025 6:55 PM UTC

That worked.  Thank you!

Is there a way to also change the fill color of Button1 when Checkbox1 is checked?  From its current shade of light red to a light green?  I tried adding this to your script:  oFld.fillColor=["RGB", 191 , 255, 191]

but that does not work.  I changes the color to white.

;

Translate
PDF Automation Station
Community Expert
Community Expert
Jul 3, 2025 7:12 PM UTC

Set the fill color the way you want it then run the following script in the console:

this.getField("Button1").fillColor;

It will return RGB, plus 3 numbers you can use to replace the 3 numbers in the square brackets in your script.

Translate