Javascript and submit form actions
Hello all,
I am a relative newbie when it comes to this, so any help would be greatly appreciated. I have created a form where a user fills out a form, clicks submit for approval, then it will send the form in an email to the person that has to approve it. No issue there. They fill it out click on 'submit for approval,' and the form is attached to an email that opens up, ready to enter in the approver's email address.
Once the approver receives it and opens it, they fill out the remaining fields of the form (hidden until the user clicks on 'submit for approval', then click on 'submit approved form.' The form is supposed to get attached to an email that opens up, and it is supposed to be prepopulated with email addresses of two recipients, plus the email address of the division that is chosen in an dropdown field (Division Email) for the approver.
What is happening is that an email window opens with the form attached, but it is not pre-populated with the two designated email addresses or the chosen email address. The recipient field is empty.
I have set up actions where the javascript runs first, then submit form, which is just 'mailto:' in the URL field. I feel like I am close, but do not know what that crucial step is to get the javascript to run first then open up the submit form with the designated email adresses pre-populated.
Thank you in advance!
Here is the javascript I used:
if (this.getField("Division Email").valueAsString == "traveldesk@company.com")
this.mailDoc({
bUI: true,
cTo: "traveldesk@company.com; account.rep@travelcompany.com; traveldesk@company.com;",
cSubject: "Travel authorization form " + this.getField("text1 + text2").valueAsString
});
else if (this.getField("Division Email").valueAsString == "travelcp@company.com")
this.mailDoc({
bUI: true,
cTo: "traveldesk@company.com; rachel.kronlein@corporatetraveler.us; travelcp@guttmacher.org;",
cSubject: "Travel authorization form " + this.getField("text1 + text2").valueAsString
});
else if (this.getField("Division Email").valueAsString == "traveldev@guttmacher.org")
this.mailDoc({
bUI: true,
cTo: "traveldesk@company.com; account.rep@travelcompany.com; traveldev@company.com;",
cSubject: "Travel authorization form " + this.getField("text1 + text2").valueAsString
});
else if (this.getField("Division Email").valueAsString == "travelpres@company.com")
this.mailDoc({
bUI: true,
cTo: "traveldesk@company.com; account.rep@travelcompany.com; travelpres@company.com;",
cSubject: "Travel authorization form " + this.getField("text1 + text2").valueAsString
});
else if (this.getField("Division Email").valueAsString == "travelpp@company.com")
this.mailDoc({
bUI: true,
cTo: "traveldesk@company.com; account.rep@travelcompany.com; travelpp@company.com;",
cSubject: "Travel authorization form " + this.getField("text1 + text2").valueAsString
});
else if (this.getField("Division Email").valueAsString == "travelresearch@company.com")
this.mailDoc({
bUI: true,
cTo: "traveldesk@company.com; account.rep@travelcompany.com; travelresearch@company.com;",
cSubject: "Travel authorization form " + this.getField("text1 + text2").valueAsString
});
Ki
