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

Submit form by field selection- different e-mail addresses 4 each

agkonstant
Registered: Apr 19 2010
Posts: 11
Answered

Hello,

I have a form where there are 2 mutually exclusive radio buttons- changed the values to yes and no so that when one is selected a checkmark occurs, but the other cannot be selected.

Everything is fine except I would like the form to submit to different e-mail addresses depending on which radio button is selected.

For example: button 1- Brantford
button 2- Quincy

If brantford is selected I want the form to submit to email1 [at] konstant [dot] com

If quincy is selected I want the form to submit to email2 [at] konstant [dot] com

How do I make or insert variables or javascript to make this happen? This is not a webbased form yet, so I do not understand how or where to put the javascript/ html coding?!?

Please help!

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
PDF forms don't use HTML. JavaScript is the language used to script both forms and Acrobat. You'll find lots of tutorials on this site that explain how to enter scripts into PDF.

Acrobat displays two different form types, AcroForms and LiveCycle forms. Assuming that you have an Acroform, then this article explains how to modify the email address at runtime.

http://www.acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

agkonstant
Registered: Apr 19 2010
Posts: 11
I understand how to modify the e-mail addresses in the submit button that I created- in it's properties to fill in the to; cc; bcc; subject; message fields if need be. That part is ok.

I do not understand how to put preferences or variables around radio buttons. Do I have to change the properties of the radio buttons to be submit a form and put the values in there?

Won't that make my form submit right after that field is chosen? That field is only 1/2 down my form- I want the rest of the information to show.

Basically I have read the JavaScripting link and it is not very clear to me- I know I need to modify my radio button field properties but do I set them up like submit buttons in the properties field?

Do I even need a submit button at the bottom then if I change my radio button properties/actions to be submit forms?

Sorry if this is unclear but I am very confused. I know what I want to do and it should be easy enough I just do not know what to put in where.

Thanks for your patience.
agkonstant
Registered: Apr 19 2010
Posts: 11
Sorry, what I need is the javaScript-

I looked again and realise I need to set the Properties of my radio buttons "Actions" to Mouse Up and Run a JavaScript but from there I do not understand which javaScripting I need to put in

The article does not (at least to my knowledge) describe easily how set the parameters for submitting the document if said fields are chosen. I don't know how to actually write the variables:

if true, false etc and how that will tie into my submit button below.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
if you search the tutorials for "radio button" you'll find several articles that use radio buttons in scripts. But the gist of it is this. Each button in a group has an export value. This export value is the value of the group when that button is selected. So if you want to set an email in your submit button script you could write the code like this:
var cMailSelect = this.getField("RadioButSelect").value; if(cMailSelect == "Brantford")this.submitForm({cURL:"mailto:<span class="spamspan"><span class="u">email1</span> [at] <span class="d">konstant [dot] com</span></span>"});else if(cMailSelect == "Quincy")this.submitForm({cURL:"mailto:<span class="spamspan"><span class="u">email2</span> [at] <span class="d">konstant [dot] com</span></span>"});elseapp.alert("email selection not set");

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

agkonstant
Registered: Apr 19 2010
Posts: 11
Finally figured it out!

Thank you- sorry it wasn't as clear to me as it should have been.

Very frustrating, but now it works!
agkonstant
Registered: Apr 19 2010
Posts: 11
Ok issue- it is sending in fdf format and I want it to send in pdf form.

here is what the code I am using looks like:

var cMailSelect = this.getField("Quincy").value;

if(cMailSelect == "Yes")
this.submitForm({cURL:"mailto:mike [dot] fennema [at] konstant [dot] com?subject=Order Acknowledgement/Order ProductionForm&body=Please see the attached form"});else if(cMailSelect == "No")
this.submitForm({cURL:"mailto:jeff [dot] keane [at] konstant [dot] com?subject=Order Acknowledgement/Order ProductionForm&cc=mark [dot] heckliable [at] konstant [dot] com&body=Please see the attached document"});else app.alert("email selection not set");

Where do I add in the cSubmitAs: "PDF",cCharset:"utf-8" part in?

This has to be the most frustrating thing ever- wish I knew someone who was a programmer!

Any help would be GREATLY appreciated.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Here's an article to that discusses the submtForm function.

http://www.acrobatusers.com/tutorials/2006/submitting_data

Here's the modified submitForm()

this.submitForm({cURL:"mailto:mike [dot] fennema [at] konstant [dot] com?subject=Order Acknowledgement/Order ProductionForm&body=Please see the attached form", cSubmitAs: "PDF", cCharset:"utf-8"});Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

agkonstant
Registered: Apr 19 2010
Posts: 11
Thank you sooooo much Thom!