Avatar

Correct answer by
Level 10

Hi Carol,

Here is a sample: https://acrobat.com/#d=awe4XZzrtamYOUcs8pKiPA

You can use a regular button instead of a Submit by Email button. Setting it up is straight forward, the following is script in the click event of the regular button.

// First give a messageBox with instructions

xfa.host.messageBox("This will open your email client and prepare an email for you. " +

     "Please make sure you send the email to complete the process." +

     "\n\nIf you experience any difficulties or if you are using a " +

     "web based email client, then please save this form and " +

     "manually email it to someone@acompany.ie\n\nThank you!", "Email Instructions", 3, 0);


xfa.host.beep("3");


// then pass instructions through to email client

var vEmail = "someone@acompany.ie";    

var vSubject = "A9100 - Example of Email Button Script";

var vBody = "Hi\n\nPlease find attached the completed form in PDF format.\n\nRegards,\n\n" + nameField.rawValue + "\n" + companyField.rawValue;


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

You can hardwire the email addresses, subject line and message into the script or you can have elements of these set to the values of objects on the form.

Hope that helps,

Niall

View solution in original post