Expand my Community achievements bar.

SOLVED

Multiple Dropdowns Email Multiple Recipients

Avatar

Former Community Member

Hi,

I am trying to get 3 different dropdown menus to determine the multiple recipients of a submitted form. I can't seem to get them all to work at once, ...only one or another. This is the click event script I am using on the Submit button. Could someone help me identify what is wrong with my syntax (particularly the vEmail portions)?

// First check if there are null values, then construct email using script
var vEmail =  "";
var vSubject = "";
var vBody = "Attached to this email is a Field Service Issue - Parts Order Form.";
var vName = "";
var vCC = "greg.gustafson@zero-zone.com";
var vFormat = "PDF";
var errorMessage = "You have not provided enough information:"; 

{
     vSubject = "Field Service Issue - Parts Order Form";
}

// Check email address field and build error message
if (Page1.SendFormTo.rawValue == null || Page1.RSM.rawValue == null || Page1.CST.rawValue == null)
{
     errorMessage = errorMessage + "\n - Please select who you want to send this form to, including RSM & CST.";
}
else
{
     vEmail = Page1.SendFormTo.rawValue, Page1.RSM.rawValue, Page1.CST.rawValue;
}
{
     vCC = "greg.gustafson@zero-zone.com";
}

// If fields required for script are null, warn user and do not initiate email
if (Page1.SendFormTo.rawValue == null)
{
     xfa.host.messageBox(errorMessage, "Sending an email", 0, 0); // Send out a custom error message if any of these fields are null
}
else
{
     // Everything is OK, send email
     event.target.submitForm({cURL:"mailto: "+ vEmail +"?subject=" + vSubject +"&body=" + vBody + "&cc=" + vCC,cSubmitAs:vFormat,cCharset:"utf-8"});
}

Regards,

ZeroZone

1 Accepted Solution

Avatar

Correct answer by
Level 6

I guess issue is with your concatination....I see an issue with following line of code...

vEmail

= Page1.SendFormTo.rawValue, Page1.RSM.rawValue, Page1.CST.rawValue;

I would use following....to concatinate all the email address....

vEmail

= Page1.SendFormTo.rawValue + ", " + Page1.RSM.rawValue + ", " + Page1.CST.rawValue;

View solution in original post

2 Replies

Avatar

Correct answer by
Level 6

I guess issue is with your concatination....I see an issue with following line of code...

vEmail

= Page1.SendFormTo.rawValue, Page1.RSM.rawValue, Page1.CST.rawValue;

I would use following....to concatinate all the email address....

vEmail

= Page1.SendFormTo.rawValue + ", " + Page1.RSM.rawValue + ", " + Page1.CST.rawValue;