Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Insert data from a field into the subject of an email generated form a form

Not applicable
Hi,



Is there a way to have the contents of a field come up in the subject of an email that is made when a submit by email button is clicked.



The data we want is from a date field for a 'week commencing'.



We have a text string that is entered on the button's properties - email subject, but we'd like to add the contents of a field on the form onto this.



any ideas?



thanks,



declan.
19 Replies
Not applicable
Try this code in the click-event of the mail-button (you will have to adjust it of course):



var anrede;

if (xfa.form.Formular.Beratungsprotokoll.Kunde.Anrede.rawValue == "Herr") {

anrede = "Sehr geehrter Herr "; }

else {

anrede = "Sehr geehrter Frau "; }



var mailText = anrede + xfa.form.Formular.Beratungsprotokoll.Kunde.Name.rawValue +

"\nPlease print this form and mail it to me!" +

"\n\nTo speed up processing you can also click on the button 'ok'. " +

"This will generate an e-mail. Please send this e-mail to me." +

"\n\nThank you" +

"\nYour agent";



event.target.submitForm({cURL:"mailto:" +

Formular.Beratungsprotokoll.Kunde.EMail.rawValue +

"?subject=consulting minutes&body=" + mailText,

cSubmitAs:"PDF",cCharset:"utf-8"});
Not applicable
Declan O'Toole, Did you have success using the script given above?
Not applicable
Thanks Carl,



No, I didn't Carl. Sorry for the delay in reply.



I'm not a programmer and wasn't able to get my head round the code.

Thanks very much for your help though, Declan.
Not applicable
Has any one had any luck with this?
pguerett
Level 10
Level 10
If you use the mailto protocol on a submission you will be able to create the URL programmatically and set it
Not applicable
http://www.savefile.com/files/1683720



the form consists of a text field, a regular button with javascript on its click event as follows:



var subject = sub.subject.rawValue;



event.target.submitForm({cURL:"mailto: someone@home.com?subject=" + subject +"&body=Please find attached the completed form.",cSubmitAs:"XDP",cCharset:"utf-8"});



(my favourite topic)
Not applicable
Hi,



Chris, Thank you for your explanations. I was looking for the same answer.



If I do this though, the data returned is in .xdb Format. How do I have to change the code, so I will get a .pdf form in return.



Or: is it possible to name the file that will be sent back to me with the contents of a field when the "submit by email" button is clicked?



Thank you,



Olivio Donati
Not applicable
Sorry, found the answer to the first question...



But the second still remains: How can I automatically change the name of the file that will be sent back to me with the contents of a field when the "submit by email" button is clicked?
pguerett
Level 10
Level 10
You can't. The name of the file will be the name of the originating PDF. If you are running in preview mode the name will be a temp name that is not very useful. Once you save the form and run it from your OS then it will have a proper name.
_Edgar_van_Waar
Level 2
Level 2
Using the default "submit by e-mail"-button won't allow you to do that, but by using (java)script you can make it more dynamic.



Try this:



var assembledEmailString = "mailto:" + addresseeText + "?&subject=" + subjectText + "&body=" + bodyText;

event.target.submitForm({cURL:assembledEmailString ,cSubmitAs:"PDF",cCharset:"utf-8"});



(where "addresseeText", "subjectText" and "bodyText" are variables you can fill with your own data.



Hope this helps!
_Edgar_van_Waar
Level 2
Level 2
Using the default "submit by e-mail"-button won't allow you to do that, but by using (java)script (at the 'click'-event of a regular button) you can make it more dynamic.



Try this:



var assembledEmailString = "mailto:" + addresseeText + "?&subject=" + subjectText + "&body=" + bodyText;

event.target.submitForm({cURL:assembledEmailString ,cSubmitAs:"PDF",cCharset:"utf-8"});



(where "addresseeText", "subjectText" and "bodyText" are variables you can fill with your own data.



Hope this helps!
Not applicable
Hi,



I used a regular button and the digital signature to it. I have it set to send the form via e-mail with a subject Title. When testing it I noticed that after the user presses the button to sign and submit the form it populates the signature on the screen and after you press ok it goes ahead and e-mnails the form to the correct E-mail account, but that signature does not show when opening that E-mail. It shows the button still there. I want it to produce the signature of the person signing when it is sent, not hte button itself and I would also like hte form to lock after it is signed an sent so no changes can be made to the form.



Can anyone help me?
Not applicable
Edgar...I do not know if that is silly or not but..in which part should I place that part of code? so my email subject can get the info from specific field on the form.

Thanks in advance for your aid. 🙂
_Nojun_Kmail_
Level 2
Level 2
I'm trying to change the subject line, body, and cc in a re-programmed and successfully tested submit process. I tried now in several ways to put code discussed here into this script but I get either invalid token messages or nothing happens when I hit the submit button. Does someone know how to adapt this script:




RealEmail.event__click.submit.target = "mailto:" + DropDownList1.rawValue + "subject:" + subjectText + "body:" + bodyText;

RealEmail.execEvent("click");

} else {

app.alert("Please select a choice from the drop-down list!");

}


Not applicable
I'd love to get this too. I am trying to get a form to submit by email with the subject line of the email generated from two text fields in the PDF. I don't know how to program, but I could insert the code if instructed how. My eyes are going cross trying to figure this out. Can anyone help?
pguerett
Level 10
Level 10
You would do it as Nojun has shown except that you need a ? between the to address and the subject and then a & symbol between every other parameter.
Not applicable
So, instead of DropDownList1.rawValue, I would insert:



TextField1.rawValue + TextField2.rawValue (instead of dropdownlist1.rawValue)



a ? between the to address and the subject



a & symbol between every other parameter...



Paul, could I send you my form for you to change? Once I see how you do it I'm sure I can modify the rest of my forms. I'm not even sure how to insert the code without LiveCycle requiring that I change the form to .xpd... I've never programmed anything before.
pguerett
Level 10
Level 10
Sure ...send it to livecycle8@gmail.com
drizagon
Level 3
Level 3

Hello,

Paul, could I have you send an example to me of a form that is utilizing this submit option? I would greatly appreciate it. You can send to chad.lass@biworldwide.com.