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

Creat my own email button (Can't get it to work)

rodbunn
Registered: Feb 3 2008
Posts: 81
Answered

I am using the sample script in the LiveCycle book and I want to create a button that sends an e,mail using a "text" field for the e.mail address;
What am I missing ????? The Text field and the Button are in the same place;
xfa.form.form1.InputSubform1.PrintSubForm.TextField4 (test field for address)
xfa.form.form1.InputSubform1.PrintSubForm.Button4 (regular button)

var mail;
var address = xfa.form.form1.InputSubform1.PrintSubForm.TextField4 ;
var sub = "Test email from rod";

mail = "mailto: " + address + "?subject=" + sub;
event.target.submitForm({
cURL: mail,
bEmpty: true,
cSubmitAs: "PDF",
cCharset: :utf-8"
});

Thanks for help in advance !!!!! Rod

My Product Information:
LiveCycle Designer, Windows
DominicanPete
Registered: Jan 4 2008
Posts: 41
I used this code to add email functionality to a standard button. You need to attach the javascript code to the 'click' event of the button. You will need something like this:


var myDoc = event.target;
var address = TextField4.rawValue;
var sub = "Test email from Rod";
var msgBody = "This is text in the body of the message if you want";

myDoc.mailDoc({
bUI: false,
cTo: address,
cSubject: sub,
cMsg: msgBody,
cSubmitAs: "PDF"
});
}

If you want to send to more than one email address, concatenate your addresses together in a single field and separate each address with a semi-colon.

Make sure that your language is JavaScript for the code. Run At: must be set to 'Client'.

This is a more flexible way of sending off the email as you have a bit more control over what goes on.

Good luck!