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

Sending an Email without submitting form

SymmetryMedical
Registered: Apr 21 2010
Posts: 26
Answered

Hi

I've got no experience with Javascript at all so I'm trying to struggle through this. I've read dozens of posts but they all seem to show how to submit a form, not just send an email (without the form attached) and I don't know how to seperate the two.

Basically, what I want, is a javascript that when they finish the form, they click the submit button and it sends an email to someone in the company letting them know it's complete. The subject of the email needs to be the customer order number (which is one of the fields on the form).

------------

var subject = this.getField("SalesOrderNumber");

this.mailDoc({
bUI: false,
cTo: "name [at] company [dot] com",
cSubject: subject.value,
cMsg: "The Form is now Complete"
});

--------------

This opens an email with the document attached, the address is correct, the body is correct, but the subject just says: undefined.
I've put this together by piecing little bits from different sites together but it's obviously not right, I just don't know enough to make it right.

Any help?

My Product Information:
Acrobat Standard 9.3.1, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2399
Replace this.mailDoc with app.mailMsg

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Niall
Expert
Registered: Apr 26 2006
Posts: 62
Hi,

Nearly there...

In the cSubject line drop the .value:

cSubject: subject,

(Note: "subject" may be a reserved word, so using something like "vSubject" may be better).

If you use app.mailMsg instead of mailDoc, it will send an email without the PDF attachment.

Hope that helps,

Niall


oops...

Hope this helps,

Niall
Assure Dynamics

try67
Expert
Registered: Oct 30 2008
Posts: 2399
Niall, dropping the value property is not good advice (if you do it the variable will point to a Field object), although changing the name of the variable is.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Niall
Expert
Registered: Apr 26 2006
Posts: 62
Thanks try67, I'll bear that in mind. Crossover from XFA ;-)

Niall

Hope this helps,

Niall
Assure Dynamics

SymmetryMedical
Registered: Apr 21 2010
Posts: 26
Thank you, that's sorted it. Glad I wasn't a million miles off.

Have changed the variable name and now that works too, perfect.

Thank you all again!