Skip to main content
laurit93394268
Participating Frequently
August 24, 2016
Answered

Disabling a submit form button in Adobe Acrobat DC?

  • August 24, 2016
  • 3 replies
  • 5406 views

Hello-

​I am trying to create a fill-able form in Abobe Acrobat DC that has javascript that will save it, flatten all the fields and the submit form button and then submit the form as an attachment in an email. However, I am failing to get the submit button to disable. Is there a code that can help? I also need to know where to place it in my line up of actions for the button.

​Thank you.

This topic has been closed for replies.
Correct answer try67

Thank you for helping out. However, it didn't work for me. The button is still active. Any other ideas on a different code?

Sorry,


Should have double-checked the code... It needs to be this, of course:

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

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

    f.readonly = true;

}

3 replies

laurit93394268
Participating Frequently
September 1, 2016

Hello-

I still need assistance. I used the code to flatten the pdf and it worked, however... When I sent the flattened pdf with data written in the fillable forms to a Document Automation & Order Management Software, the filled form was blank.  I am perplexed. Any ideas?

try67
Community Expert
Community Expert
September 1, 2016

Well, the code above doesn't actually flatten the file. It just sets the fields as read-only. It sounds like there's something wrong with that system you're using. If you want to really flatten the file then you can use this code (Acrobat only):

this.flattenPages();

Just realize that if you do that there will not be any more fields in the file. They will all become static content.

laurit93394268
Participating Frequently
September 1, 2016

Where in the code do I place:

this.flattenPages();

I am not sure where to put it? Or is that all I need to use in the javascript prompt?


Please let me know.

Thanks.

laurit93394268
Participating Frequently
August 24, 2016

After the form is an attachment on the email. The submit form button is still active even after everything else is flattened on the form.

try67
Community Expert
Community Expert
August 24, 2016

How are you flattening it, exactly?

laurit93394268
Participating Frequently
August 24, 2016

I found a javascript code on a youtube video. Not even sure what it really is, just know it works.

Here it is:

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

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

if (f.type != "button") // do I have to change the word between " " with the name of my button which I put on my PDF? name of button is "Valider"

{

f.readonly = false ;

}

}

Inspiring
August 24, 2016

When exactly do you want the button to be disabled?