Expand my Community achievements bar.

Customizing the "Email Submit Button"

Avatar

Level 1

I'm trying to customize the "email submit button" of a form so that whenever the user of the form clicks on the button it will save a copy of the form into a specific folder with the file name of the copy linked to one of the fields in the form. Then attach the copy of the form into an email with the subject linked to a separate field from the form. Finally have the orginal form closed. The part I don't have working is the save as file name, subject, attaching the copied PDF, and closing the orginal form. Any ideas? I'm using Designer 7.0

1 Reply

Avatar

Level 6

I have never tried to save a form with a preset file name but following code may help you overcome some of the issues you have...I never tried to close a form with script either.

I would use regular button instead of email button and use the following code in "click" event which will compose the email and attach the form in PDF format with the same name as it opens. Hope you can compromise on name of the attached document.

try {
var subj = "email subject here";
var ebody = "email body text here"

var mailTo = person@domain.com
//xfa.host.messageBox("In a moment new email gets composed attaching copy of your request. Please complete the process by sending the email.")
event.target.submitForm({cURL:"mailto:"+mailTo+"?subject="+subj+"&body="+ebody,cSubmitAs:"PDF",cCharset:"utf-8"});
}catch (e) {
//xfa.host.messageBox(""+e);
xfa.host.messageBox("There was an error submitting this form as email.\nPlease email your concerns about this form to youremail@domain.com.\nPlease include the error description in the email.");
  exit;
}