These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Help to create a SEND-button to different users

mikeyb
Registered: Sep 4 2011
Posts: 20
Answered

Hi everybody!
 
I was wondering if anybody could help me.
How do I make users send a form to different e-mails when they click the SEND-button? (they have to be able to select which e-mail before pressing the SEND-button).
 
With HTML, I can use javascript to make a dropdown-list (with different emails in it) that they select before they click the SEND-button.
 
How much can I do with the SEND-button inside my PDF-form?
  
Any help is much appreciated.
  
- Mikey B

My Product Information:
Acrobat Pro 10.0.1, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
You can use a drop-down list with email addresses in Acrobat as well.
Let's say this drop-down is called "Email". You then use the following code in a "Run a JavaScript"-action of your button:
  1. var email = this.getField("Email").value;
  2. this.mailDoc({ bUI: true, cTo: email, cSubject: "Subject of the email goes here", cMsg: "Message body of the email goes here" });

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

mikeyb
Registered: Sep 4 2011
Posts: 20
try67 wrote:
You can use a drop-down list with email addresses in Acrobat as well.
Let's say this drop-down is called "Email". You then use the following code in a "Run a JavaScript"-action of your button:
  1. var email = this.getField("Email").value;
  2. this.mailDoc({ bUI: true, cTo: email, cSubject: "Subject of the email goes here", cMsg: "Message body of the email goes here" });
Thank you for a fast reply, but am I supposed to have 2 actions in the SUBMIT-button now? One for "Submit a form" and one for "Run a Javascript".

I pasted your code inside the Javascript-action:
var email = this.getField("Email").value;
this.mailDoc({ bUI: true, cTo: email, cSubject: "Subject of the email goes here", cMsg: "Message body of the email goes here" });

But nothing happened.
I hope it's ok for you that I sent you an email.
maxwyss
Registered: Jul 25 2006
Posts: 255
Do you have inserted a combo box field named "Email" which contains the e-mail addresses?

And, no, you can get rid of the "Submit form" action, because the submitting is handled in the JavaScript.

Hope this can help.

Max Wyss.

mikeyb
Registered: Sep 4 2011
Posts: 20
Thank you for all your replies.
I tried try67's suggestion and it finally worked>! ;)
mikeyb
Registered: Sep 4 2011
Posts: 20
It appears that the REQUIRED-fields that I set on the form isn't working while using try67's code.
Is there a way to activate it? As for now, anyone can send the form empty.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You will need to write your own verification of the form. Basically, you use a loop to iterate over all the fields and check if they are:
- an input field (ie not a button)
- required
- filled-in (this depends on their type)

Search the forums, this was discussed several times.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
If you want to take advantage of the required property of fields to automatically prevent the submit from taking place, you can use the submitForm method instead of the mailDoc method. You would have to use a mailto type URL. But try67's approach in post #6 is better, even if you use submitForm, since it is more flexible and allows you to provide customized feedback to the user by creating your own app.alert.