Expand my Community achievements bar.

SOLVED

Email submit button question

Avatar

Level 4

I have created a form my users fill out to request training from the supervisors. Everything works great but I was wondering something. When the user fills out the form & hits the submit button at the bottom of the form it attaches the filled out document to their email. In the body of the message it automatically puts the following in:

Request for Training

The attached file is the filled-out form. Please open it to review the data.

Is there any way I can change the caption "The attached file is the filled-out form. Please open it to review the data." to something else like "The attached is a fille dout trainign request form. Please open it & approve or disapprove this training request"

Thanks,

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

No problem!

Here is a screen shot where I have dragged a regular button onto the form and then in the script editor I have pasted the script into the click event.

Parallels Desktop1.png

Yes, setting the show to 'click' will display the script in the click event.

Yes, the sample uses Javascript, so set the language to this.

Yes, it is a regular button.

It may not work in LC Designer Preview, so save your file and open it in Acrobat. It should work then. The above form works.

Note, because it is sending the form as a PDF, it will not work in Reader, unless the form is Reader Enabled.

I hope that helps,

Niall

View solution in original post

6 Replies

Avatar

Level 10

Hi,

You can set up a custom email script in a regular button to give a specific text string in the email message.

Have a look at the first email button in this example: https://acrobat.com/#d=JXrO*Eb8bm9jtqFWwxYmsA

Good luck,

Niall

Avatar

Level 4

It still is not working..here's what I did:

I changed the button control type to regular. With the button highlighted I then changed "show" to click*. The I changed the language to JavaScript. Then I added the following code

switch (airportCode.rawValue) { case "EDDN": var vEmail = "someone@EDDN.ie"; var vSubject = "Airport: EDDN" break

case "EDDP": var vEmail = "someone@EDDP.ie"; var vSubject = "Airport: EDDP" break

case "ETAR": var vEmail = "someone@ETAR.ie"; var vSubject = "Airport: ETAR" break

}

var vBody = "Hi\n\nPlease find attached the completed form in XDP format.\n\nRegards,\n\nNiall" event.target.submitForm({cURL:"mailto: "+ vEmail +"?subject=" + vSubject +"&body=" + vBody,cSubmitAs:"PDF",cCharset:"utf-8"});

What am I doing wrong?

Avatar

Level 10

Hi,

The example gets the email address and the subject line based on objects in the form.

If your form does not have these objects, then the script will fail.

Here is script that does not rely on objects in the form:

var vEmail = "niall@ireland.com";

var vSubject = "This is the subject line";

var vBody = "Hi\n\nPlease find attached the completed form in PDF format.\n\nRegards,\n\nNiall"


event.target.submitForm({cURL:"mailto: "+ vEmail +"?subject=" + vSubject +"&body=" + vBody,cSubmitAs:"PDF",cCharset:"utf-8"});

I hope that helps,

Niall

Avatar

Level 4

Thanks, I am very new to scripts with livecycle, actually I've never done anything like this

before so please excuse my stupid questions....

If I use the last code you posted do I leave the "Show" as click* & the language JavaScript? I think I'm pasting the code in the correct place. I'm pasting it in the top between Show & Language. I'm also leaving the control type set to regular.

I put the code in you just sent & still nothing happens.,

Avatar

Correct answer by
Level 10

Hi,

No problem!

Here is a screen shot where I have dragged a regular button onto the form and then in the script editor I have pasted the script into the click event.

Parallels Desktop1.png

Yes, setting the show to 'click' will display the script in the click event.

Yes, the sample uses Javascript, so set the language to this.

Yes, it is a regular button.

It may not work in LC Designer Preview, so save your file and open it in Acrobat. It should work then. The above form works.

Note, because it is sending the form as a PDF, it will not work in Reader, unless the form is Reader Enabled.

I hope that helps,

Niall

Avatar

Former Community Member

Hi there,

Thanks for the submit script...very usfull for me...

I created a form with costum submit button using your script...Here is what I'm trying to do:

When user hit submit button, ms outlook opens and in the body appears my text...at the end of my text appears what he/she wrote in one of the text fields. It's a field for client's name.

Is it possible to do this?

Thanks