Expand my Community achievements bar.

Specify Subject and File Name when using E-Mail Submit button

Avatar

Level 2

Hello,

I'm using an E-Mail Submit button in my form, and I'd like to specify the Subject of the E-Mail and File Name of the file attached to the e-mail when the form is submitted.

I know I can do this by using a regular button and mailDoc, but that allows me to send the form in pdf.  My clients only have the reader, so I need to be able to send the data in XML format.

The reason why I like using the E-Mail Submit Button is that I can easily ensure that all required fields are non-blank.

So again, how can I specify the Subject of the E-Mail and the File Name of the attached form when using an E-Mail Submit Button?

Thanks

Markus

1 Reply

Avatar

Level 1

Hi Markus,

Use this code sample:

var

childsName =

xfa.resolveNode("Santaapp.page1.sContent.sColumn1.sAppdetails.sAppstatic.yname").rawValue;

var

toAddresses =

"mailto:santaslittlehelpers@avoka.com";

var

subject =

"Santa mail";

if

(childsName != null

){

subject

+= (" - " +

childsName);

}

var

message =

"\nDear Santa,\n\nI have been good and filled out your form.\n\n\I promise to be asleep on Christmas Eve.\n\nFrom,";

if

(childsName != null

){

message

+= ("\n\n" +

childsName);

}

event.target.submitForm({cURL

:toAddresses + "?subject="+ subject + "&body=" + message

,

bEmpty

: true,

// Post all fields (true), or do Not post all fields (false)

cSubmitAs

: "XML",

// Post Data

cCharset

:

"utf-8"});

Regards,

Michael Beilin