Customizing form submission buttons can provide a more dynamic form, such as presetting parameters for e-mail out a form!
Modifying the submit button in a PDF form by including a JavaScript formula in the action will allow you to specify whom you send the pdf form to (in a form of an attachment), and also preset the subject line and also include messages in the body!
The script below is an example of what to insert in the action for a Push Button (Properties > Action > Select Action > Run a JavaScript > Add…).
var sendTo = this.getField("sendTo").value;
var ccTo = this.getField("ccTo").value;
var theSubject = this.getField("theSubject").value;
var emailBody = this.getField("emailBody").value;
this.mailDoc({
bUI: false,
cTo: sendTo,
cCC: ccTo,
cSubject: theSubject,
cMsg: emailBody
});
The parameters are set by pulling the values from the Text Fields created within your PDF form (Note: the names of the fields are case sensitive!).
The names under this.getField(“xxxxx”).value; will be the name of the Text Fields, which in return will be plugged into the mailDoc.
For e.g. the text field name for the person to send to is named “sendTo”, which in returns is set as the var sendTo = this.getField(”sendTo”).value;