Skip to main content
Participant
July 6, 2020
Answered

Adding multiple email fields to a Javascript

  • July 6, 2020
  • 2 replies
  • 717 views

Hi,

 

New here and to Javascript too. I'm looking to create a 'submit' button on a form which interrogates the form for the email addresses and populates the To address with 1 email and the Cc address with 2 emails from the form. I've managed to get it working partly but am struggling to get the second cc email address to be included. Code so far below (without the third email field name which is "Line Manager's email address").

 

var cToAddr = this.getField("Staff Email 2").value;
var cCcAddr = this.getField("Area Admin email").value;
this.mailDoc({
bUI: false,
cTo: cToAddr,
cCc: cCcAddr,
cSubject: this.getField("First Name 2").valueAsString + " " + this.getField("Last Name 2").valueAsString + " " + "LDR Report" + " " + this.getField("DateField_af_date").valueAsString,
cMsg: "Please find attached your LDR Report.\n" + "Save the form for your own CPD records."
});

This topic has been closed for replies.
Correct answer try67

Use this:

 

var cCcAddr = this.getField("Area Admin email").value + ";" + this.getField("Line Manager's email address").value;

2 replies

shane56Author
Participant
July 7, 2020

Thanks - that's perfect 🙂

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 6, 2020

Use this:

 

var cCcAddr = this.getField("Area Admin email").value + ";" + this.getField("Line Manager's email address").value;