Email Form button with Javascript
I apologize in advance if this is answered multiple times, I just could not find what I needed.
I am trying to have a button send my form (as an attachment) to hard-coded email addresses as well as email addresses based on field values while also having a Subject line and Body determined by the JavaScript.
Based on what I found, here is my Javascript (added under "Button Properties">"Actions">"Mouse Up" Trigger>"Run a JavaScript" Action):
var cToAddr = this.getField("first.last@website.com").value;
var cCcAddr = this.getField("Preparer Email").value;
var cSubLine = this.getField("Location Name").valueAsString + " " + this.getField("Change Type").valueAsString + " " + "COS Request" + " " + this.getField("Date_af_date").valueAsString;
var cBody = "Please see the attached COS form for immediate processing.\n" + "Save the form for your own records."
this.mailDoc({bUI:true, cTo: cToAddr,cCc: cCcAddr,cSubject: cSubLine, cMsg: cBody});
I don't get any Syntax errors, but when I test it and click the button, nothing happens...
I'm a rookie at JS, but am working to learn more.
*Bonus points if you have any tips for populating multiple email addresses based on a dropdown field value (EX: If dropdown value is "A", I need the email to be sent to Email(s) 1,2,3,4, & 5. If dropdown value is "B", the email needs to go to 2,4,6, & 8). I figure I might need hidden text fields for each dropdown value with the emails listen in them?
