Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

"CC" an Email Address Based on Radio Button Selection

Avatar

Avatar
Validate 1
Level 1
ZeroZone
Level 1

Likes

2 likes

Total Posts

12 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
ZeroZone
Level 1

Likes

2 likes

Total Posts

12 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
ZeroZone
Level 1

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)

Avatar

Avatar
Applaud 5
Level 2
sergiy2511
Level 2

Likes

0 likes

Total Posts

21 posts

Correct Reply

6 solutions
Top badges earned
Applaud 5
Affirm 5
Affirm 3
Affirm 1
View profile

Avatar
Applaud 5
Level 2
sergiy2511
Level 2

Likes

0 likes

Total Posts

21 posts

Correct Reply

6 solutions
Top badges earned
Applaud 5
Affirm 5
Affirm 3
Affirm 1
View profile
sergiy2511
Level 2

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)