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

Help with Livecycle Forms - Two Email submit buttons

jtholloway
Registered: Oct 27 2009
Posts: 13
Answered

Greetings. I am currently having an issue with Adobe 8 forms. I am using Livecycle to design the form and need two separate email buttons.

First I'd like to distribute the form to users to enable dataset collection.

I would like one email button for the user to send to analyst(s) and want the button to attach the form in PDF and prompt them to enter an email address. I don't want the form automatically sent to default addresses, because every user will have a different analyst.

The other email button would be for the analysts who verify the form, add fill out additional form fields, and then submit it using the submit button (linked to the distribute forms feature) in order to return ALL the data to me for analysis in a dataset.

I thought I could do this by creating one button for users and one button for data collection experts, but Livecycle balks at that idea. It only wants one email submission button.

Any help provided would be much appreciated. I am very new to Livecycle (just started last weekend) and need to create a form for my company ASAP. Thank you all in advance.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The trick is to add a regular button to your form that does an email submit using JavaScript, which is of course the only way to set an email address at runtime. Here's a link to an article that shows how to dynamically set an email:

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

The article shows how to do this on an AcroForm, but the technique is exactly the same for LiveCycle Forms, the only difference is that you have to replace the document pointer "this" with "event.target".
For example:
this.submitForm(...)

Becomes
event.target.submitForm(...);

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

jtholloway
Registered: Oct 27 2009
Posts: 13
Thanks for your quick reply. I'll try this when I get to work today. A few clarifications though, due to my inexperience:

1. It will submit the form as a PDF correct?

2. If I don't place an email address in the parentheses of the script, it will open the default email program (Outlook in my case), attach the file to a new email, and prompt the user to enter an email address?


Thanks again!
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
From a script you can submit the PDF any way you want. I'm not sure if its possible for the submit to specify an empty email address. Usually you'd setup the script to pull an email address off the form or provide a popup input dialog for getting the email from the user before doing the submit.

Read the articles, they'll make it much more clear, and attend my eSeminar today. I'll be covering this.
http://www.acrobatusers.com/users/thomp

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

jtholloway
Registered: Oct 27 2009
Posts: 13
Your JavaScript worked perfectly (thanks!). However when I went to distribute the forms I got the following error: "Adobe cannot distribute the form because it contains multiple submit buttons......". Is there any work-around solution for this? All I want the button to do is open my Microsoft Outlook, create a new message and attach the form in PDF and not effect the "real" email button.

I watched the video and read the links you posted, but I was unable to find the answer I was looking for. Thanks for your help/patience with this.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I did a couple of test with LiveCycle 8 and 8.2 on Acrobat 8 and 9. I used one official submit button and one button that used code to do an email submit. And didn't see the two submit button issue. As long as the button that runs code to perform the submit is a regular button, the distribute wizard will not recognize it as a submit button. It sounds like your form contains two Official submit buttons.

Here's the code in the button that uses a script to do the submit:

event.target.submitForm("mailto:me [at] wj [dot] com"); // email address is fictionalI used Acrobat to do the distribute, not the functionality in LiveCycle.

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

jtholloway
Registered: Oct 27 2009
Posts: 13
I'll have to try that as well. One button was the Livecycle email button and the other was a script and I still got that error. I did find a work around though.

1. Complete your form but change one email button to a regular button instead of an email button.

2. Distribute the form to yourself and create your dataset.

3. Receive the form and change the regular button back to an email button. Do not make any other changes. Save the file as a new form.

4. Send that form out to your recipients for distribution (not using the distribute button) just by plain old email.

5. When the form is returned to you filled out, just import it into your dataset.


It's kind of a rag-tag way of doing it, but it solves my problem. I just hope I'm not losing too much functionality by doing it this way. I'll try your way again tomorrow. Thanks for all your help on this. It is MUCH appreciated.
jtholloway
Registered: Oct 27 2009
Posts: 13
It worked! Is there any possible way to submit it as a pdf though instead of fdf? Thanks for all the help.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Certainly, the submitForm function has a "cSubmitAs" input. Look it up in the Acrobat JavaScript Reference.

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

jtholloway
Registered: Oct 27 2009
Posts: 13
I finally got it to work! Looks like I'll be beefing up on my JavaScript this weekend. Thanks for all your help. You're a valuable resource on this board.