These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Adding recipients to CC email base on checkboxes

cm48
Registered: May 7 2010
Posts: 4

hello,

I have created a form which contains checkboxes. Each checkbox will represent an e-mail address. When the checkbox is checked, I would like the email address to be CC to the email. When the checkbox is deselected, I would like it to be removed from CC. I am having problems coding it. When the checkbox is deselected the CC address is set to default, I receive the following error: Microsoft Office Outlook does not recognize "". I am deciding the form in Adobe Livecycle. The checkbox does add the email address. How can add multiple checkboxes and avoid the Outlook error message? Can anyone help me clear up the code?

The following is the code I have written.

var gaemail = "jr [at] abz [dot] com, jc [at] abz [dot] com, mc [at] abz [dot] com, "; //default email addresses

if (Fleetsheet.rawValue == 1 ) //if the checkbox is true is will add the below recipient to CC.
{
var flmail = "jo [at] abz [dot] com";
}
if (Fleetsheet.rawValue == 0) // if the checkbox is false it will remove the recipient from CC. I receive an Outlook error.
{
var flmail = gaemail;
}
event.target.mailDoc({
cTo: "itsupport [at] abz [dot] com",
cCc: "jr [at] abz [dot] com, jc [at] abz [dot] com, mc [at] abz [dot] com, " + flmail,
cSubject: NewEmployee.rawValue + " - " + Subform1.Subject.rawValue,
cMsg: "Please review the attached document. \n\nThank you,\nHuman Resources",
cSubmitAs: "PDF",
cCharset: "utf-8"
});

Thanks for your help,
CM

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The problem is with the syntax of the email addresses. First, the separator for multiple email addresses is a semicolon, although I'm not sure this is very important. Second, it looks like your code is repeating the email address in the case where (Fleetsheet.rawValue == 0). But I don't think outlook is complaining about either of these issues. I think it doesn't like the hanging comma at the end of "gaemail".

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

cm48
Registered: May 7 2010
Posts: 4
Thanks so much. Wow. It was the comma. As soon as I removed it. It started to work. thanks for your help.