Expand my Community achievements bar.

SOLVED

Adding text field to e-mail subject

Avatar

Former Community Member

Hi all,

I've got a button on my form that should submit the form in pdf format, to a fixed mail address with a fixed subject message, that has variable content dragged from a text field, i.e "Subject; New e-DCR <TextField12.rawValue>"

Firstly, I got everytihng working with an automatic Submit by E-mail button, but couldn't solve the subject line text issue.  Next, I added a normal button, with a Regular controil type, & tried the following script (from another forum post) under the Click event in script editor - now, the button won't even fire....

var Mailto = "mail@mailaddress.com";

var Subject = "New e-DCR" + TextField12.rawValue;

var Mail = "mailto:" + Mailto + "?Subject=" + Subject;

event.click.submitForm({

cURL: Mail,

bEmpty: true,

cSubmitAs: "PDF"

});

I'm a complete n00b at scripting, so any advice & help would be very much appreciated.  Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 9

Sent you the form along with description. Check your mail.

Thanks,

Bibhu.

View solution in original post

10 Replies

Avatar

Level 9

Hi Ian,

This can be done by using a dummy submit button.  Try the following.

Drag a button into the form. Lets name it as DummySubmitButton. Then in the control Type select Submit. In the Presence dropdown select Invisible.Then select Submit tab next to Field tab.Then in the SubmitURl mention the url you want to send. Like this - mailto:test@testmail.com. Select Submit As XML/ PDF as you want. This button will not be visible in the form.

Now drag another button. Lets name as SubmitButton. This will be visible in the form. It will be or regular control type. In the click event of this SubmitButton write the following code

DummySubmitButton.event__click.submit.target = "mailto:test@testmail.com" + "?subject=" + "New e-DCR " + TextField12.rawValue ;

DummySubmitButton..execEvent("click");

What this script will do is it will use set the submit functionality like mailto, Subject before submitting. After setting these parameters finally the click event of the dummy button would be called and it will submit the form.

Hope this helps.

Thanks,

Bibhu.

Avatar

Former Community Member

Thanks Bibhu - very easy to follow, but still no luck.  I've copied your instrucitons to the letter, but the button simply doesn't fire any response.

I have named the buttons exactly as you mention;

New Picture (21).jpg

And the script as typed;

New Picture (21).jpg

Any more advice?

Avatar

Level 9

Hi Ian,

That script image you have posted is too small to view. Have you pasted the script in the click event of the Submit button? Have you made the Submit Button as a general button and the DummySubmitButton as a Submit button? It should work. Could you please paste the script that you have written again? Incase you still find any difficulty you can mail the form at bibhu69@gmail.com.

Thanks,

Bibhu.

Avatar

Former Community Member

Yep - script in Click event section, as JavaScript

Yep - SubitButton is Regular

Yep - DummySubmitButton is Submit, with url box filled as; mailto:mail@mail.com

Script as follows;

New Picture#.jpg

Your continued assistance much appreciated

Avatar

Level 9

Hi Ian,

The problem is you are sending the form as a PDF, right? If you send the form as a PDF it requires reader extenstion. But If you want to send the data as XML it will not require reader extension. You can reader exten the form using Acrobat Pro or you buy a trial.full license from Adobe.

But first try it using Submit as XML. Just for trying purpose. If it works, you will be convinced whether the script works or not. Buut it works at my end.

Thanks,

Bibhu.

Avatar

Former Community Member

I've changed it and it makes no difference; have tried all 4 Submit As formats, but the button still fails to fire a response.

When I was usign the Submit as Email button, it cfreated a mail with .pdf attachment, no problems at all...

Avatar

Level 9

There is some problem. I need to see the form. Could you please send the form to bibhu69@gmail.com?

Bibhu.

Avatar

Correct answer by
Level 9

Sent you the form along with description. Check your mail.

Thanks,

Bibhu.

Avatar

Level 1

Hi Bibhu, i'm having the same problem... can I send you my form also, i've tried everything

Avatar

Level 2

Thanks for this script. Found it very useful. I would like to point out that there is a typo in the second line of the script. It has an extra full stop before the execEvent("click) which needs removing.

Greig