Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

How do you control the subject of email that has PDf form attached

Avatar

Level 3

I have created a form with a button set to submit a PDF (using mailto:) to a particular email address.  This all works great. 

Now what I would like to do is to control the subject line of the returned emails. I want them to be easily identifiable in a group mail box and so they can all have the same Subject line.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Here is the corrected form.

https://acrobat.com/#d=VmIrzKJAw1iP2K*AhJlpXQ

I made both the phone number and Location as optional fields.I am checking those fields in the Submit Email button click event. If they have values then the user can submit the form. Otherwise the form will throw a message that one or more of the mandatory fields are missing data..(You can customize the message according to you).

This new approach will stop the Submit Cancelled to appear in the form..

Hope this helps..

Thanks

Srini

View solution in original post

7 Replies

Avatar

Level 3

Thank you Srini. 

I have tried modifying the example you have given to me but it does not quite do what I need.  There may be something I am missing. 

I don't need or want the person filling out the form to provide an email address or a subject. I want to have bothe the address and subject line associated with the submit button so that all they do is press the submit button and send the email, it will fill the correct subject in and send to the right address.  Hope this makes sense.

Sorry, if that is very obvious from the example you gave me, I just can't work it out.

Thanks again.

Avatar

Level 10

You can try like this.. Place this in the preSubmit event of the Button (with type set to "Submit")..Java Script as the Language.

I have declared variables that can hold values that can be passed to the Email function. Where ever you have values you can assign them.

For example, if you want to display the Subject from the value of TextField1 on the form, then write like this..

          strSubject = Form1.Subform1.TextField1.rawValue;

    Do the same way for rest of the variables. If you do not have a value for any of them, just assign empty double quotes, as I did below.

var strToAddress, strCCAddress, strSubject, strMessage

strToAddress = "";
strCCAddress = "";
strSubject = "";
strMessage = "";

event.target.submitForm({cURL:"mailto:"+ strToAddress + "?cc=" + strCCAddress + "&subject=" + strSubject + "&body=" + strMessage,cSubmitAs:"PDF"});

Hope this helps..

Thanks

Srini

Avatar

Level 3

Hi Srini

Thanks so much that has got me so close but I am having two strange things happening. 

* Two of the fields on my form are "required" a phone numebr and a location.  I can have the phone number "required" without any impact, but when I make the location "required" it no longer understands what I want in the subject of the email.  As soon as I turn the location back to "optional" it fills the subject out fine. Do you have any idea?

* The other thing that is happening is that the email opens with the form attached and address and subject correct, but at the same time it throws up an error in Acrobat that says "Submit cancelled".  Although you seem to be able to ignore this, I am sure it will be confusing to my clients trying to use the form.  Do you have any ideas what is might be going wrong?

I appreciate all of the help so far and I can see that if I can just fix these niggly things, I will be able to have what I need.

Avatar

Level 10

Do you still have issues with the send email. If so send me the file I can have a look at it.. (LiveCycle9@gmail.com)..

Thanks

Srini

Avatar

Correct answer by
Level 10

Here is the corrected form.

https://acrobat.com/#d=VmIrzKJAw1iP2K*AhJlpXQ

I made both the phone number and Location as optional fields.I am checking those fields in the Submit Email button click event. If they have values then the user can submit the form. Otherwise the form will throw a message that one or more of the mandatory fields are missing data..(You can customize the message according to you).

This new approach will stop the Submit Cancelled to appear in the form..

Hope this helps..

Thanks

Srini

Avatar

Level 3

I can see what you have done, and that makes all the difference.

Thank you for your help