"CC" an Email Address Based on Radio Button Selection

ZeroZone

20-03-2019

I am trying to set up a submit button to "CC" a specific email ONLY IF if a yes/no radio button is checked "Yes", but I'm at a loss how to fit that into my button script.

My radio button "Yes" value is "Page1.RadioButton.YesNo.Yes" and it has the email address I want to CC as the value, where the "No" value is set to "1".

This is my submit button script:

var vEmail = "name1@address.com" + ";" + "name2@address.com";

var vSubject = "Form submitted by " + Page1.Requestor.rawValue;

var vBody = "Attached to this email is a form submitted by " + Page1.Requestor.rawValue + ".\n\nThank you.";

var vCC = "";

var vFormat = "PDF";

var errorMessage = "At least one required field was empty. Please fill in the required fields (*) before continuing.";

if (Page1.Requestor.rawValue == null || Page1.RadioButton.YesNo.rawValue == null)

{

    errorMessage = errorMessage;

}

if (Page1.Requestor.rawValue == null || Page1.RadioButton.YesNo.rawValue == null)

{

    xfa.host.messageBox(errorMessage, "Sending an email", 0, 0);

}

else

{

    event.target.submitForm({cURL:"mailto: "+ vEmail +"?subject=" + vSubject +"&body=" + vBody + "&cc=" + vCC,cSubmitAs:vFormat,cCharset:"utf-8"});

}

Any help appreciated.

Thank you.

ZZ

Accepted Solutions (1)

Accepted Solutions (1)

sergiy2511

20-03-2019

Hi, you need to conditionally determine your vCC variable, after your var vCC = ""; put something like this:

if (your condition){

vCC = "email@youwanttobe.ccd"

}

Answers (0)