Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Suppress Submit Button After Sending

New Here ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

Hello,

I'm trying to suppress the submit button after sending a form so it doesn't show to the person I'm sending it to.  Below is the code I used from this forum but for some reason it does not work.  FYI, it's a fillable form saved as "Reader Extended". 

 

this.getField("Print").display = display.hidden;

this.getField("Reset").display = display.hidden;

this.getField("Txt_Email").display = display.hidden;

this.mailDoc({cTo: "recipientname@aol.com"});

 

I also want to be able to send the form to whoever is selected from a drop down list.  Is there a way to do both in the same script?  Right now though, I need to get the buttons suppressed.  Can anyone please help me out with this?  Thanks!

TOPICS
How to, JavaScript, PDF forms

Views

828

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

- What's the name of this field?

- Read this tutorial: https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

PS. You should be "suppressing" it before sending it, not after. Doing it after means the copy the recipient receives will have the field visible...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

How would I suppress it before sending it?  I would need those buttons while using it.  I'm confused.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

The name of the field to obtain the mail recipient is "Sent via Email".  There are about 10 options in the drop down box.

 

Any idea on how to suppress those buttons?

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

Just like you did with the "Print", "Reset" and "Txt_Email" fields... Add a command to hide it before the mailDoc command.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

I just thought of something.

I am creating these forms for someone else to use.  They would like the buttons gone after they hit the submit button.  Would they need Adobe Acrobat full version or would this work with them using the Adobe Reader?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

Just like you did with the "Print", "Reset" and "Txt_Email" fields... Add a command to hide it before the mailDoc command.

 

I thought that's what the little script was for:

 

this.getField("Print").display = display.hidden;

this.getField("Reset").display = display.hidden;

this.getField("Txt_Email").display = display.hidden;

this.mailDoc({cTo: "recipientname@aol.com"});

 

I'm sorry, I don't know javascript but I thought this script was basically hiding the buttons prior to sending.  

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

Yes, it does. Isn't that what you want to do with your Submit button, too?

Just add this line to it, before the last one:

this.getField("Sent via Email").display = display.hidden;

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

Good Morning/Afternoon, Try67!  Thanks for helping me out, you've been quite helpful!  I've been agonizing over this because I was not expecting my client to request this.  I thought she just wanted to print the form.

 

So, I think I got the buttons hidden with this command:

 

this.getField("Print").display = display.hidden;

this.getField("Reset").display = display.hidden;

this.getField("Txt_Email").display = display.hidden;

this.mailDoc({cTo: "myname@aol.com"});

 

This works when I test it on my desktop email (Outlook), but now I have a couple questions:

1. I've noticed I must re-open the file to have the buttons come back.  In other words, I would not be able to change the email address and send one after another.  Am I correct?

2. When viewed on my phone (ios) the buttons are still there (but not usable) so I'm wondering if hiding the buttons only works on desktops.

 

Thanks Bunches!

(I think next I'll have to agonize over pulling email addresses from "Sent via Email" drop down!  ...gasp!)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

1. Not necessarily. You can un-hide them directly after sending the file, by adding these commands to the end of your current code:

 

this.getField("Print").display = display.visible;

this.getField("Reset").display = display.visible;

this.getField("Txt_Email").display = display.visible;

 

2. Correct. Almost no scripts are going to work on mobile devices, unfortunately.

 

3. Sorry, I thought that "Sent via Email" was the name of the button you wanted to hide. I see now it's the drop-down. What you want to do is actually quite simple. All you need to do is set the email addresses as the export values of the names of the items in the drop-down (for example, the name could be "John Doe" and the export value "john.doe@gmail.com", or whatever). Then just adjust this line in your code:

 

this.mailDoc({cTo: "myname@aol.com"});

 

To:

 

this.mailDoc({cTo: this.getField("Sent via Email").valueAsString});

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

Oh, that worked!  Only thing is: Now it prints.  Is there a string that makes the buttons visible but not printable after sending?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

Yes. Change:

display.visible

To:

display.noPrint

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

LATEST

Worked great, Thanks again try67!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines