Copy link to clipboard
Copied
I want to write a script that changes the line style of certain checkboxes (i.e. "solid", "dashed") and also potentially change the border color to "none" in order to remove the border.
More specifically I have a bunch of checkboxes with names ending in a number. When a textbox is updated with a number I want all checkboxes up to that number to change to lineStyle Solid.
Copy link to clipboard
Copied
To change the border color of a field use the strokeColor property; To change the line style of a field use the borderStyle property; To change the line width of a field (which is the best way to make it have no border at all) use the lineWidth property.
To edit multiple fields up to a number you can use something like this:
var maxFields = 10;
var n = Number(this.getField("Text1").valueAsString);
for (var i=1; i<=maxFields; i++) this.getField("Checkbox"+i).strokeColor = (i<=n) ? color.red : color.black;
This will change the border color of all fields from 1 to N as red, and all the others as black.
Copy link to clipboard
Copied
More specifically I have a bunch of checkboxes with names ending in a number. When a textbox is updated with a number I want all checkboxes up to that number to change to lineStyle Solid.
To change the border style of a group of checkboxes in Adobe Acrobat, you can use the borderStyle property of the field objects. Assuming your checkboxes are named "Check Box1", "Check Box2", ..., and the number of checkboxes to update is entered into a text field, you can use the following script as the custom validation script for that text field:
var n = Number(event.value);
for(var i=1; i<=n; i++){
this.getField("Check Box"+i).borderStyle = border.s;}
solid - border.s
beveled - border.b
dashed - border.d
inset - border.i
underline - border.u
Copy link to clipboard
Copied
To change the border color of a field use the strokeColor property; To change the line style of a field use the borderStyle property; To change the line width of a field (which is the best way to make it have no border at all) use the lineWidth property.
To edit multiple fields up to a number you can use something like this:
var maxFields = 10;
var n = Number(this.getField("Text1").valueAsString);
for (var i=1; i<=maxFields; i++) this.getField("Checkbox"+i).strokeColor = (i<=n) ? color.red : color.black;
This will change the border color of all fields from 1 to N as red, and all the others as black.
Copy link to clipboard
Copied
More specifically I have a bunch of checkboxes with names ending in a number. When a textbox is updated with a number I want all checkboxes up to that number to change to lineStyle Solid.
To change the border style of a group of checkboxes in Adobe Acrobat, you can use the borderStyle property of the field objects. Assuming your checkboxes are named "Check Box1", "Check Box2", ..., and the number of checkboxes to update is entered into a text field, you can use the following script as the custom validation script for that text field:
var n = Number(event.value);
for(var i=1; i<=n; i++){
this.getField("Check Box"+i).borderStyle = border.s;}
solid - border.s
beveled - border.b
dashed - border.d
inset - border.i
underline - border.u
Find more inspiration, events, and resources on the new Adobe Community
Explore Now