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

Need help with Javascript!

lailalee2010
Registered: Jun 25 2010
Posts: 2

Hello to all,

I am desperate for a fix and hoping someone can help me. I have a PDF form that I want submitted via email as a PDF attachment. I need to submit button to email to one email address and cc: to two other addresses based off the information provided on the form.

I have written the JavaScript and it works, but when I extend the features in Adobe Reader it leaves off the second email address. But if you close the email window and press submit again it works. I have changed my email address below for privacy, but otherwise it's exactly the same.
Can someone help please?
Thanks
Laila

Here is the script:
// so that the form is always returned to the same address
// Change address on your form
var cToAddr = "firstname [dot] lastname [at] companyname [dot] com";
// First, get the client CC e-mail address
var cCCAddr = this.getField("ClientEmail").value;
// Now get the beneficiary e-mail only if it is filled out
var cBenAddr = this.getField("BennyEmail").value;
if(cBenAddr != "")
cCCAddr += ";" + cBenAddr;
// Set the subject and body text for the e-mail message
var cSubLine = "New Hire Requisition Form";
var cBody = "Thank you for submitting your form, Human Resources will respond within 24 to 48 hours.\n" +
"Please remember to cc: your 2nd level approver in order to approve the position, salary and posting costs.";
// Send the form data as an PDF attachment on an email
this.mailDoc({bUI: true, cTo: cToAddr, cCc: cCCAddr,
cSubject: cSubLine, cMsg: cBody});

My Product Information:
Acrobat Standard 9.3.1, Windows
Diane123
Registered: Sep 14 2010
Posts: 1
I am new to javascript and am getting really frustrated! I am trying to find an annual amount, basically "field1 * 12". Is it possible to use "12" even though it's not in a field? Please help!
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Yes, it's possible, but you really should pose this question in a new topic.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
> I am new to javascript and am getting really frustrated! I am trying to find an annual amount, basically "field1 * 12". Is it possible to use "12" even though it's not in a field? Please help!Yes, but if it is a number in JavaScript do not put it within quotation marks of any kind as that would indicate a text string and and not a numeric value.

If you use the 'simplified field notation' calculation option:
field1 * 12

If you use the custom calculation script:
event.value = this.getField('field1').vlaue * 12;

See [url=http://acrobatusers.com/tutorials/2006/form_calculations]How to do (not so simple) form calculations[/url] by Thom Parker for more information.

http://acrobatusers.com/tutorials/2006/form_calculations

George Kaiser