Create email message body from form values

1.5k views Asked by At

In Livecycle Designer ES2, is it possible to edit the XML of the Submit button to take data from the filled form and put it into the message body of the email? As an example, if I had the following field / values:

firstName / John
lastName / Smith
DOB / 1/1/72
email / [email protected]

The message body of the email would look like this:

Name: John Smith DOB: 1/1/72 Email Address: [email protected]

1

There are 1 answers

0
poliglot On BEST ANSWER

In order to send email you can use app.mailMsg() function from AcroForms specification. Add a standard button to your form and add the following code to its click event:

//Email adressee
var cToAddr = "[email protected]";

//Subject
var cSubLine = "Put proper subject here";

//Body
var cBody = "Name: "+firstName.rawValue+" "+lastName.rawValue+" DOB: "+DOB.rawValue+" Email Address: "+email.rawValue;

// Send an email
event.target.app.mailMsg({bUI: true, cTo: cToAddr, cSubject: cSubLine, cMsg: cBody});

Detailes about app.mailMsg() function and similar ones you can find here: http://acrobatusers.com/tutorials/print/dynamically-setting-submit-e-mail-address