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

Email address from Text Field

adobecurio
Registered: Aug 5 2007
Posts: 2

Dear Group, I am trying to write a javascript for a button that emails the pdf to the email address on the form entered into a field named "emailother" I am new to scripting but I understand that to get the field data I need this.getField and field name but how do I insert that after the cTo:
 
this.mailDoc({
bUI: false,
cTo: "emailone [at] example [dot] com",
cCc: "", //???? what can I do to get the data from field "emailother" to appear here?
cSubject: "MOC Approval",
cMsg: "Please review, sign and forward this document to the next person in the approval workflow. Thank you."
});
Any Help Appreciated

My Product Information:
Acrobat Pro 8, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
If you are using AcroForms, not LiveCycle forms, then you use the "getField()" function. Here's how to do this from a button script.

var myField = this.getField("emailOther");
var cEMailURL = myField.value;

this.mailDoc({bUI:false, cTo: cEmailURL,...});

Of course, there are some problems here,
1. you need to make sure that the email address has the correct format.

2. the mailDoc function is restricted to use in either Acrobat Pro, or a "Save" enabled PDF in Reader.

3. In order to use "bUI:false", the script must be executed from a privileged context.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script