Skip to main content
Known Participant
May 5, 2016
Question

How do I disable all fields when sending a pdf through the "submit a form" button?

  • May 5, 2016
  • 1 reply
  • 11940 views

I want to make sure that the fillable fields will not be editable when received via email.

Thank you!

This topic has been closed for replies.

1 reply

Karl Heinz  Kremer
Community Expert
Community Expert
May 5, 2016

If this solution needs to work in both Adobe Acrobat and the free Adobe Reader, your only option is to set the fields to read-only in your form. You can do this by running a loop over all fields and then set the "readonly" property to "true":

for (var i=0; i<this.numFields; i++) {

    this.getField(this.getNthFieldName(i)).readonly = true;

}

Depending on how your button is set up, you may have to add two different actions (or add this script to your already existing JavaScript action):

Known Participant
May 5, 2016

That's fantastic. (And forgive me for my lack of knowledge with regard to Adobe Acrobat...I'm learning, but it's going slowly..) The ultimate goal is that the "disabled" form is only disabled when it is sent via email. Now the issue I'm running into is that the code also locks the "reset form" button which is crucial for filling out the document again for a new client.  Any solutions??

Known Participant
May 5, 2016

Yes, these few lines will set all fields to read-only, regardless of what they are. If you want to exclude certain fields based on their name, you can do that, but you can also exclude e.g. all buttons. If there are no other buttons besides the reset and the submit button, that would be the most straight forward way of doing this. If there are other buttons, you would have to use the field name to find out if it's one of the fields you want to retain as interactive.

The following script will exclude all buttons:

for (var i=0; i<this.numFields; i++) {

    var f = this.getField(this.getNthFieldName(i));

    if (f.type != "button") {

        f.readonly = true;

    }

}

You would have to change your reset action to also change the form fields to read/writeable again. However, the better solution would be to never save the modified file after it's submitted, and always start with a fresh copy from the disk when you want to start with a new client.


That makes so much sense, however, the sales guy MIGHT want to save the version that he's working on in case he's not yet ready to submit. I just want to be sure I've give him the easiest way to start a fresh form and I'm totally open to suggestions.

If the best bet is to make the form fields read/writable again is through a script, would you happen to have an easy one to share?