These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

shortest javascript to select all fields in a document

sol.manager
Registered: Oct 1 2009
Posts: 17

I have a digital signature that is set to mark all fields as read only once signed. This same field has a mouse down event attached to it to perform some other functions. I would like to have the digital signature run a custom script once executed, that combines my script with the "mark all fields as read only" option included with the digital signature.

What is the shortest bit of javascript that will a) select all fields in a document b) make all fields read only. I would like to select all fields at once, rather than find and lock each one individually.

My Product Information:
Acrobat Pro 8.1.6, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
There's no way in Acrobat JS to get all the fields at once. The only way is to use getField on each specific field. My suggestion is to create an array of the fields' names and then iterate over it, setting the readonly value to true.
Something like this:

var fieldsArray = new Array("field1", field2", "field3");
for (f in fieldsArray) {
f.readonly = true;
}

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com