Acrobat Javascript + save a field as a variable then email it

kingmike
kingmike used Ask the Experts™
on
I have a form with a spot to put an approvers email address. Once they do this I want the javascript on the submit button to save that as variable approver email. Then it will autmatically email the form to the approver.

I am not sure how to assign the contents of the text box to that variable or how to send the email to that variable.?

Thanks,

//This javascript will validate fields then send form.
var approverEmail;

if (this.getField("employeeName").value == '')
{
 app.alert('Please enter an employee name');
isFormValid = false;
}

if (this.getField("branch").value == '' || this.getField("branch").value == '----Please Select----')
{
 app.alert('Please enter your branch');
isFormValid = false;
}

if (this.getField("respCode").value == '')
{
 app.alert('Please enter a responsibility Code');
isFormValid = false;
}

if (this.getField("branchNumber").value == '')
{
 app.alert('Please enter your branch number');
isFormValid = false;
}

if (this.getField("customerName").value == '')
{
 app.alert('Please enter a name');
isFormValid = false;
}

if (this.getField("customerAddress").value == '')
{
 app.alert('Please enter an address');
isFormValid = false;
}

if (this.getField("customerSS").value == '')
{
 app.alert('Please enter an account number');
isFormValid = false;
}

if (this.getField("customerAcct").value == '')
{
 app.alert('Please enter an account number');
isFormValid = false;
}

if (this.getField("newCustomerAcct").value == '')
{
 app.alert('Please enter a new customer account number');
isFormValid = false;
}

if (this.getField("newCustomerName").value == '')
{
 app.alert('Please enter a new customer name');
isFormValid = false;
}

if (this.getField("date").value == '')
{
 app.alert('Please enter a date');
isFormValid = false;
}

if (this.getField("approverEmail").value == '')
{
 app.alert('Please enter a date');
isFormValid = false;
}

if (isFormValid)
{
this.mailDoc(true, approverEmail, "acctspayablestaff@scbtonline.com", "", "Subject goes here");

}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
This is how you assign a value to a variable

var emailId = this.getField("approverEmailField").value;

Author

Commented:
exactly what I needed to know. Thanks once again for your help. I learn more every time I post a question.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial