The following is based on examples from Stefan Cameron's article "Submitting Form Data by Email."
Please help. I'm having trouble with a "quick and dirty" form which contains only these 4 fields: “unitId”, “emplName”, “jobTitle”, and “probDesc”. The “TO” and “SUBJECT” fields will have static values. The email body should appear exactly as shown, assuming that the user inputs:
unitId = 110123
emplName = Joe Blow
jobTitle = General Manager
probDesc = The only problem I have to report is that the sky is falling.
The final body msg is show between the lines:
————————————————
%AFFECTED END USER= 110123
%CATEGORY=ServiceDesk
%GROUP=TSC TICKET
%DESCRIPTION=Employee Name: Joe Blow Job Title: General Manager Problem:
The only problem I have to report is that the sky is falling.
———————————————
Here’s the code.
—– form1.#subform[0].Email.Send::click: – (JavaScript, client) —
function GetBody()
{ var body = “Message Body: ” + “\n”;
body += “%AFFECTED END USER= ” + UnitId.Value + “\n”;
body += “%CATEGORY= ” + category.value + “\n”;
body += “%GROUP= ” + group.value + “\n”;
body += “%DESCRIPTION=Employee Name: ” + emplName.value + "Job Title: " + jobTitle.value + "Problem Description: " + probDesc + “\n”;
return body;
};
body = GetBody( );
var newTarget = “mailto:” + to.value + “?” + “body=” + encodeURIComponent(GetBody());
submitNode.target = newTarget;
EmailSubmitButton.execEvent(“click”);
If all you want is to send an email with the simple data in the body then you are much better off not using the email submit button at all. Use the "app.mailMsg()" instead. It's much simpler and more straight forward, and there are no dependancies on some other submit button.
app.mailMsg({cTo: to.value, cSubject:"???", cMsg: GetBody()});
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