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

How to make a fillable field part of email subject

barilas
Registered: Mar 25 2009
Posts: 7
Answered

I have a pdf form that has a button that submits the filled form via email as a PDF. I would like to change the subject of the email to contain one of the fillable fields of the form.

I have Acrobat Designer 7.0

Thanks for your help,

Edgard

My Product Information:
Acrobat Standard 7.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Internally in a LiveCycle form, the email submit action is a "mailto" URL, where the subject, as well as CC, BCC, and the message body are all query parameters on the URL. You can use the MouseDown event on the submit button to change these parameter at runtime.
// Find the submit actionvar subNd = this.resolveNode("#event.submit");// Add subject textsubNd.target = "mailto:<span class="spamspan"><span class="u">wj</span> [at] <span class="d">wj [dot] com</span></span>?subject="+TextField3.rawValue;

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]

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

barilas
Registered: Mar 25 2009
Posts: 7
Thanks for the quick reply.

I tried it but the subject line comes as "null". Also, I would like to add standard text in the subject as well like "(TextField1) order has been received", how would I do that? Sorry but I am really new to all this...

hanks again,

Edgard
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Thats actually good, it means it's working. The reason the value is null is either because the form field it's getting data from is empty, or the URL is not encoded properly

Adding more text to the subject is just adding more text.

subNd.target = "mailto:wj [at] wj [dot] com?subject="+TextField3.rawValue + " order has been recieved";But since this is an URL it has to be URL Encoded (which could also have been the problem)
So do it like this:

var cMyURL = "mailto:wj [at] wj [dot] com?subject="+TextField3.rawValue + " order has been recieved";
subNd.target = encodeURI(cMyURL);

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]

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

barilas
Registered: Mar 25 2009
Posts: 7
Now it has the file name as the subject line, the same as in the original submit button I had. Any thoughts? Thanks!
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Try this, Use a "console.println()" to display the URL. Then look in the console window and see what's reported.

Here's a recap of the code, Make sure it is in the MouseDown action for the Email Submit Button
// Find the submit actionvar subNd = this.resolveNode("#event.submit");console.println("Submit URL: " + subNd.target );// Build the new URLvar cMyURL =  "mailto:<span class="spamspan"><span class="u">wj</span> [at] <span class="d">wj [dot] com</span></span>?subject="+TextField3.rawValue + " order has been recieved";console.println("New URL: " + encodeURI(cMyURL));// Apply new URLsubNd.target = encodeURI(cMyURL);

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]

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

barilas
Registered: Mar 25 2009
Posts: 7
Hi Thom, I had a prior issue with the form that I just resolved and your first option did work now. Thanks!!!

Edgard
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Ok, how about marking this one as answered?
Cheers,

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