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

Changing the default e-mail body

Mitchotron
Registered: Mar 20 2009
Posts: 21
Answered

Thanks to all the great help on this forum I've been able to create one button that:
-Makes the form Read Only
-Copies 2 text fields into subject line
-Hides the submit button
-E-mails the form

However when the e-mail is generated the body says:
"The attached file contains data that was entered into a form. It is not the form itself.

The recipient of this data file should save it locally with a unique name. Adobe Acrobat Professional 7 or later can process this data by importing it back into the blank form or creating a spreadsheet from several data files. See Help in Adobe Acrobat Professional 7 or later for more details."

I want to put my own message in the body. I cannot find anywhere in the code where this message is auto generated.

Any ideas?

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
If you use the default mail button, you can't change the message body.
For this task you have to programm your own mail button.

Check the tutorials of this forum, they show you how to do.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

mingdichen
Registered: Jan 7 2010
Posts: 29
I used two button method to solve my problem.

One button (in its click event):

var body="Your Body Message"

Button8.event__click.submit.target = "mailto:"+Email.rawValue+"?subject=" Subject Line Information"+"&bcc="+bcc+"&body="+body;Button8.execEvent("click");

2nd button (it is real submit button):

in my case, it is Button8


Hope, it will help you.
Mitchotron
Registered: Mar 20 2009
Posts: 21
radzmar,
I've created the button using your great tutorials, its not an email button. Here is the code:

form1.#subform[0].Button1::preSubmit:form - (JavaScript, client)
if(xfa.host.messageBox("Email Form."
, "Enable write protection",2,2)==4)
{
for (var i = 0; i < xfa.host.numPages; i++)
{

//Protect all form fields!
var oFields = xfa.layout.pageContent(i, "field");
var nNodesLength = oFields.length;
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++)
{
oFields.item(nNodeCount).access = "readOnly";Button1.presence="invisible";
this.resolveNode("#event").submit.target = "mailto:me [at] mycompany [dot] com?subject=Pre Build for " + txtProjectName.rawValue + " Proposal#" + txtCP.rawValue
body="Whatever"
}
}
}

Where can I override the default message body with my own text?
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
You can do this in this way:

Form1.#subform[0].Button1::click - (JavaScript, client)if(xfa.host.messageBox("Email Form.", "Enable write protection",2,2)==4){for (var i = 0; i < xfa.host.numPages; i++){//Protect all form fields!var oFields = xfa.layout.pageContent(i, "field");var nNodesLength = oFields.length;for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++){oFields.item(nNodeCount).access = "readOnly";Button1.presence="invisible";}} //Optional: //Put some values from form fiels in variables to use them in the mail subject or message bodyvar SubjectAdd1 = SomeFormField1.rawValue;var SubjectAdd2 = SomeFormField2.rawValue;var MessageAdd1 = SomeFormField3.rawValue;  var myDoc = event.target;var address = "<span class="spamspan"><span class="u">somebody</span> [at] <span class="d">example [dot] org</span></span>"; // use , to separate several adressesvar sub = "Your Subject " + SubjectAdd1 + " from " + SubjectAdd2;var msgBody = "Your Mailbody\n\n" + MessageAdd1 + " more text... \n = is to add a line break"; myDoc.mailDoc({bUI: false,cTo: address,cSubject: sub ,cMsg: msgBody,cSubmitAs: "PDF"});}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

klwalsh611
Registered: Sep 10 2009
Posts: 28
radzmar - can this code be used in Acrobat Pro? I don't use Livecycle because I work on a Mac.

thanks!
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Nope, AcroForms use another kind of JavaScript.

Check out Thom Parkers tutorial.
[url]http://www.acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address[/url]

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

klwalsh611
Registered: Sep 10 2009
Posts: 28
Thanks very much for the quick response and the link!