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

fillable field as email subject

delmer
Registered: Jul 6 2007
Posts: 2

I have a PDF form created that has a email button that sends the form to my address in the PDF format. It all works great except I would like one of the fillable text fields automatically inserted as the subject of the return emial. We use these forms for customer service and we would like the customer name to be put in as the email subject for easy searches and reference.

My Product Information:
Acrobat Pro 8, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
See this article. One of things discussed is how to embed subject, cc, bcc, etc. into an email address.

[url=http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/submitting_data/]http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/submitting_data/[/url]

You need to do the email in JavaScript, rather than in the default action to be able to modify the address.

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

djfixxx
Registered: Mar 22 2007
Posts: 111
Could you elaborate on this, I need the subject field populated from a fillable text field. Acrobat 8.1 Pro submitting entire PDF using javascript.

It professional, networking, technical, graphical, imaging, froms.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Place a button on the PDF Page. Add a " Run a JavaScript" Action to the button and place the email submit code into it.

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

djfixxx
Registered: Mar 22 2007
Posts: 111
This is what I have

var f = this.getField("email");

this.mailDoc(true, event.mailto = f.value, "", "", "", "Congratulations on completing your personalised Trainsmart RMR assessment.\n\nPlease find your test results attched to this email as a .pdf.\nIf you have any questions or we can help in any way, please don't hesitate to contact us.\n\nBest regards from the Trainsmart team.")

It professional, networking, technical, graphical, imaging, froms.

djfixxx
Registered: Mar 22 2007
Posts: 111
Or this

var g = this.getfield("subject");
this.submitForm("mailto:mm [at] mycom [dot] com?"
+ "&cc=gg [at] mycom [dot] com&bcc=john [at] mycom [dot] com"
+ "(&subject=g.value);"
+ "&body=The order is in!"
);



I just need some code that pulls from a text box and places it in the subject line.
I see lots of requests but no valid answers or given examples.

It professional, networking, technical, graphical, imaging, froms.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Very Close on the second try. But in order for the field data to appear in the subject, the field value has to be added outside the quotes. The parentheses and semicolon are problems, remove them. There is also a syntax error on the first line. The "getField()" function is spelled with a capital "F". It's also a good idea to URL encode the field data in case it include illegal URL characharacters.

Like this:

var g = this.getField("subject");
this.submitForm("mailto:mm [at] mycom [dot] com?"
+ "&cc=gg [at] mycom [dot] com&bcc=john [at] mycom [dot] com"
+ "&subject=" + encodeURI(g.value)
+ "&body=The order is in!"
);


In fact, you'll need to "encodeURI" all the text you want to add to the various parts of the email.

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

DominicanPete
Registered: Jan 4 2008
Posts: 41
var g = ProgramTitle.rawValue;
this.submitForm("mailto:mm [at] mycom [dot] com?"
+ "&cc=gg [at] mycom [dot] com&bcc=john [at] mycom [dot] com"
+ "&subject=" + encodeURI(g.value)
+ "&body=The order is in!"
);

Use the preceeding to try and send doc as an email. Associated with the button1::click: event. Tried runat Server, Client, Both. I am able to retrieve value, but then nothing happens on the submit form. The 'this.getField' did not work either. Am using LiveCycle to develop form. Is there a difference between this and acrobat pro as far as jscipt is concerned? Any feedback is appreciated.
DominicanPete
Registered: Jan 4 2008
Posts: 41
Very tricky stuff. If you are using Java Script in LiveCycle, open Help in LiveCycle and search on this:
"Moving from scripting in Acrobat to LiveCycle Designer". Underneath is a link that speaks to Acrobat JavaScript objects that are supported in LiveCycle. Search for 'mail' and you will see that 'maildoc' is what you want to use to get complete control over the mail submission. SubmitForm is still available, but the mailto and subject information is inline with the XML, and hard to modify. Use the following code for more control over your documents to mail in LiveCycle:

var myDoc = event.target;

myDoc.mailDoc({
bUI: false,
cTo: "me [at] you [dot] com;you [at] me [dot] com",
cCC: "john [at] you [dot] com",
cSubject: "Subject Line Text",
cMsg: "Message Text here"
});

All of the items can be assigned programatically from other fields in the doc. e.g.: cTo: textField1.rawValue

Hope this helps someone else out there.
brennanhobart
Registered: Oct 9 2007
Posts: 37
Is it possible to cc a rawValue that was entered by the user? I'm trying to do this in Designer 8.

Thanks, Brennan