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

mailDoc not working and code is correct. I am going crazy.

siggy_freud
Registered: May 17 2010
Posts: 34
Answered

I have a mailDoc setup that isn't working. I copied the code from my other working document, and just changed the field names to suit.

var mailTo = this.getField("combosig2").value;
var subject = "Certificate of Acceptance for " + this.getField("Milestonename").value;

var msgBody = "Insert message body.";

this.mailDoc({bUI: true, cTo: mailTo, cSubject: subject, cMsg: msgBody});

This code works great in another form I use, but when I put this info into this certificate of acceptance form, it does absolutely nothing.

The only difference I can see is that I have these forms become visible after a digital signature is written. However, I have unlinked that requirement, and made them visible in an attempt to simply check the code and see if they are working. Still no results.

Any thoughts?

Any help is appreciated.

Javascript NEWB

My Product Information:
Acrobat Pro 9.3.1, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Have you looked in the Console window to see if any errors are reported?

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

siggy_freud
Registered: May 17 2010
Posts: 34
Doesn't seem like there are any errors reported other than the following.


this.getField("Milestonename") has no properties
2:Field:Mouse Up

However I am simply using Milestonename as part of the code for creating a subject line as you can see in my code above.

Javascript NEWB

try67
Expert
Registered: Oct 30 2008
Posts: 2398
There's your problem. It doesn't matter what you use it for. The script aborts on that line because it can't access the value property of a field called "Milestonename", probably because there's no such field. The mailDoc command never gets executed.
Fix that problem and try again.

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

siggy_freud
Registered: May 17 2010
Posts: 34
I put a default value in there of Enter Milestone Name. This is what I get:

this.getField("Milestonename") has no properties
2:AcroForm:Sendsig1:Annot1:MouseUp:Action1
this.getField("Milestonename") has no properties
2:AcroForm:Sendsig1:Annot1:MouseUp:Action1

In my other form, where I use the exact same setup, the "milestonename" type field can remain blank, and it will enter the subject line "Certificate of Acceptance for " + and then just be blank so I don't see why this field is presenting a problem. That said, if I remove that field from the Javascript altogether, the form works fine.

Javascript NEWB

siggy_freud
Registered: May 17 2010
Posts: 34
Figured it out! Stupid mistake on my end.

Milestonename, as it was written in the javascript had a capital M whereas the name of the field was milestonename, with a lower case. After that fix, it was all better. Now I feel like a dummy lol.

Javascript NEWB

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
That will do it. Any exceptions will stop code execution in it's tracks. You have fix the code so that the field name in the code actually matches the name of the field on the form.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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