Submit Form based on drop-down list selection

I have a form with a drop down list...

-optionA
-optionB
-optionC

...each option in the list has it's own email address

-optionA@email.com
-optionB@email.com
-optionC@email.com

Based on the choice a user selects from the drop-down list, when they submit the form I'd like for corresponding email address to be selected/listed within the email client so the user just has to hit "send" to fire off the email with their attached. What javascript code would I use for configuring my submit button to accomplish this?

Thanks for any help you can provide.


J. Hall


2 Answers

Voted Best Answer

Take a look at the Doc.mailForm() method (see here for the documentation: http://help.adobe.com/livedocs/acrobat_sdk/11/Acrobat11_HTMLHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Acrobat11_HTMLHelp&file=JS_API_AcroJS.89.512.html)

The first thing you should do is add the email address as export values to your dropdown control: When you bring up the field properties and go to the "Options" tab, you can specify display value (which will be displayed on the control), and an export value, which will be used when you get the selected value.

You can then add a "Submit" button to your document with a Javascript action that first gets the email address from the dropdown control (because we are using the email address as export value, that's what we are getting), and then call the mailForm() method to submit the document:

var email = this.getField("Dropdown").value;
this.mailForm(false, email);

You can add more information (e.g. a subject or a body for the mail message), all that is explained in the documentation.

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


By Karl Heinz Kremer   

Check out this articles: https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address


Thom Parker
The source for PDF Scripting Info pdfscripting.com
All About PDF Stamps in Acrobat and Paperless Workflows - THE BOOK !!

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work


Thom Parker   


Please specify a reason: