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

Disable Controls

sawanjain
Registered: Jun 12 2009
Posts: 9
Answered

Hi,

Is it possible to disable all the controls in PDF form without looping thru each and disabling them one by one.

Thanks beforehands,
Sawan

My Product Information:
Acrobat Pro 6.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Looping is pretty simple and the least of your worries since unfortunately, disabling form controls isn't really a feature in Acrobat forms, LiveCycle or AcroForm. The closest native feature to a traditional disable is setting the controls to "ReadOnly", which doesn't provide much in the way of visual cues for the user.

Fortunately there is a way to do a good looking disable (i.e. graying out), and you'll find the code for it here:

http://www.acrobatusers.com/tutorials/2007/09/js_disabling_fields

Copy and paste the function definitions presented here into a document script and then all you need to do is write a simple loop.
for(var i=0;i<this.numFields;i++){var fldName = this.getNthFieldName(i);DisableFormField(fldName);}

This code isn't too bad and it will make the presentation of your form much nicer than simply setting the fields to ReadOnly.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script