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

Locking specific fields

dphotography
Registered: Oct 24 2010
Posts: 5

Hi
I have a form that will be used in Acrobat Pro 9. I will be putting information in some fields at the top of the page and also adding a watermark. Once i've done so i'll enable features for reader and then send it off to my customers.
The bottom of the form has a section for the customer to fill out.
Is there a way to lock the fields that I pre-fill so the customer can't change it, but the customer is still able to fill out their required fields at the bottom of the form?

My Product Information:
Acrobat Pro 9.3.1, Macintosh
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Just make the fields read-only, which you can do with a script. You can also flatten certain fields, again with a script.
dphotography
Registered: Oct 24 2010
Posts: 5
Thanks George.
I don't know how to write scripts. But at least I know what to look for now.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
You can either set the field to read-only by selecting that in the Field Properties dialog, or using a script like:

// Set field to read-only
getField("Text1").readonly = true;
//Repeat for any other fields

You then have to decide where to place this code. It can be in a button, bookmark, custom toolbar button, or you can execute it from the JavaScript console. Where you choose would best be dictated by your workflow.

The problem with using just this approach is unless you've also set the default value to the same thing as the field value, or excluded these fields from any Reset Form actions that you may have set up, the fields can get cleared by the user if you've provided a means for the user to reset the form. To prevent that from happening, you can use the following script in a text field's Validate event:

// Validate script
event.target.defaultValue = event.value;

or set up any Reset Form actions to exclude these fields.

There are a lot of good tutorials here that explain the fundamentals (and more) of writing scripts for Acrobat.