Skip to main content
laurit93394268
Participating Frequently
Aug 24, 2016 9:06 PM UTC
Answered

Disabling a submit form button in Adobe Acrobat DC?

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 is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Aug 24, 2016 10:24 PM UTC

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;

}

23 replies

laurit93394268
Participating Frequently
Sep 1, 2016 5:01 PM UTC

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?

Translate
try67
Community Expert
Community Expert
Sep 1, 2016 5:04 PM UTC

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.

Translate
laurit93394268
Participating Frequently
Sep 1, 2016 6:28 PM UTC

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.

Translate
laurit93394268
Participating Frequently
Aug 24, 2016 9:44 PM UTC

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.

Translate
try67
Community Expert
Community Expert
Aug 24, 2016 9:48 PM UTC

How are you flattening it, exactly?

Translate
laurit93394268
Participating Frequently
Aug 24, 2016 9:53 PM UTC

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 ;

}

}

Translate
Inspiring
Aug 24, 2016 9:26 PM UTC

When exactly do you want the button to be disabled?

Translate