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
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??

Karl Heinz  Kremer
Community Expert
May 9, 2016

This form is killing. I tried that - see script below and nothing. The send as email and print buttons are both still active when the email attachment is opened.

{

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

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

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

           f.readonly = true;

      } else {

         f.readonly = (f.name != "Print");

           }

      }

  

    

{

var myDoc = event.target;

    var cToAddr = "user@domain.com";

    var cSubLine = "cust," +": New Construction Exterior Door Production Form Attached";

    var cBody = "Please let me know if you have any questions at all. Thank you!";

    this.mailDoc({bUI:false, cTo:cToAddr, cCC:"", cSubject:cSubLine, cMsg:cBody});

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

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

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

              f.readonly = false;  

         } 

         else {

              f.display = display.visible;

         }

    } 

this.resetForm()

}}


Are you getting any errors on the JavaScript console?