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

Submit Form to email PDF

Choi1024
Registered: Jun 1 2009
Posts: 16
Answered

This seems to be a fairly common issue in the forum, but I can't seem to get the advice found to work for me. I have a LCD 9.0 form with a regular button called Submit that I want to email a PDF. Nothing happens when I click the Submit button in LCD preview or Acrobat 9.0 Pro.

Script on the button is:

topmostSubform.Page1.Submit::click - (JavaScript, client)
//Variables to be used in the mail context
var myDoc = event.target;
var address = "myemail [at] xyzzy [dot] com";
var subject = "Deal Sheet Submission for ";
var account = topmostSubform.Page1.Header.Account.rawValue;
var from = topmostSubform.Page1.Header.Account_manager.rawValue;
var msgBody = subject + account + "\n\nProject description:\n" + topmostSubform.Page1.Header.Project_description.rawValue;

//Send mail action
event.target.submitForm({
cURL:"mailto:" + address +"?subject=" + subject + account + "from " + from + "&body=" + msgBody,
cSubmitAs: "PDF",
cCharset:"utf-8"
});

After I get it to work in Acrobat 9.0 Pro, I assume that I need to use Adavnced, Extend Features in Acobat Reader to get the form to be Reader enabled.

Thanks,
John

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
There is a difference between submitForm and mailDoc...
Thom Parker made a tutorial for this.

You should read it!
http://www.acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address

For mailing the form as PDF you need a script like:
//Variables to be used in the mail contextvar project = topmostSubform.Page1.Header.Project_description.rawValue;var account = topmostSubform.Page1.Header.Account.rawValue;var manager = topmostSubform.Page1.Header.Account_manager.rawValue; var myDoc = event.target;var address = "<span class="spamspan"><span class="u">myemail</span> [at] <span class="d">xyzzy [dot] com</span></span>";var subject = "Deal Sheet Submission for " + project + " from " + manager;var msgBody = subject + account + "\n\nProject description:\n" + //Send mail actionmyDoc.mailDoc({bUI: false,cTo: address,cSubject: subject,cMsg: msgBody,cSubmitAs: "PDF"});

Ensure, you set the language to JavaScript in the script editor.
To use this in Adobe reader you have to enable Usage Right with Acrobat first.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Choi1024
Registered: Jun 1 2009
Posts: 16
Thanks for the help. Yes, Language is Javascript and Run at is set to Client. I've read the tutorial and updated the code to use mailDoc. I publish it as Acrobat (Static) PDF Form but submit button still shows no action. I expected it to give me a prompt to select email client.

var myDoc = event.target;var address = "<span class="spamspan"><span class="u">myemail</span> [at] <span class="d">xyzzy [dot] com</span></span>";var subject = "Deal Sheet Submission for " + project + " from " + manager;var msgBody = subject + "\n\nProject description:\n" + project; //Send mail actionmyDoc.mailDoc({bUI: false,cTo: address,cSubject: subject,cMsg: msgBody,cSubmitAs: "PDF"});
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Open the form in Acrobat, press ctrl + J to open the debugger console.
Press the mail button and look, if there is a error message in the console window.
If so, which one is it?

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Choi1024
Registered: Jun 1 2009
Posts: 16
JavaScript Debugger says
topmostSubform.Page1.Header has no properties2:XFA:topmostSubform[0]:Page1[0]:Submit[0]:click

but I don't know what that means.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Ok,

looks to me that you have a code line like
topmostSubform.Page1.Header.rawValue
in the click event.

Because Header is a subform, not a field, the script fails.

Change you syntax into and ensure, there in no other code line:
//Variables to be used in the mail contextvar project = resolveNode("topmostSubform.Page1.Header.Project_description").rawValue;var account = resolveNode("topmostSubform.Page1.Header.Account").rawValue;var manager = resolveNode("topmostSubform.Page1.Header.Account_manager").rawValue; var myDoc = event.target;var address = "<span class="spamspan"><span class="u">myemail</span> [at] <span class="d">xyzzy [dot] com</span></span>";var subject = "Deal Sheet Submission for " + project + " from " + manager;var msgBody = subject + "\n\nProject description:\n" + project; //Send mail actionmyDoc.mailDoc({bUI: false,cTo: address,cSubject: subject,cMsg: msgBody,cSubmitAs: "PDF"});

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Choi1024
Registered: Jun 1 2009
Posts: 16
Javascript Debugger now says:
resolveNode("topmostSubform.Page1.Header.Project_description") has no properties2:XFA:topmostSubform[0]:Page1[0]:Submit[0]:click

I got that name from clicking on the field and looking in the script window.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hmm. interesting!

Another way. Delete the word var to define global variables for project, account and manager.

project = resolveNode("topmostSubform.Page1.Header.Project_description").rawValue;account = resolveNode("topmostSubform.Page1.Header.Account").rawValue;manager = resolveNode("topmostSubform.Page1.Header.Account_manager").rawValue;

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Choi1024
Registered: Jun 1 2009
Posts: 16
This works now. Thanks!
topmostSubform.Page1.Submit::click - (JavaScript, client)//Variables to be used in the mail contextvar project = resolveNode("Project_description").rawValue;var account = resolveNode("Account").rawValue;var manager = resolveNode("Account_manager").rawValue; var myDoc = event.target;var address = "<span class="spamspan"><span class="u">myemail</span> [at] <span class="d">xyzzy [dot] com</span></span>";var subject = "Deal Sheet Submission for " + project + " from " + manager;var msgBody = subject + "\n\nProject description:\n" + project; //Send mail actionmyDoc.mailDoc({bUI: true,cTo: address,cSubject: subject,cMsg: msgBody,cSubmitAs: "PDF"});
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Well, good news.

Please mark this answer as accepted, to help other users finding solutions with similar probs.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs