Skip to main content
RockieMB
Participant
April 12, 2016
Question

Multiple Checkbox selections to populate email address

  • April 12, 2016
  • 1 reply
  • 746 views

Hi Everyone

I have a Acrobat Pro fillable form which has a submit email button.  There are 4 checkboxes, named Checkbox101, Checkbox102, Checkbox103 and Checkbox104 which each have export values of unique email addresses.  I would like to be able to select more than one of these checkboxes to automatically populate the To fields of an email.  I am hoping to have all the address go into the one email also, not, one email for each address.  The CC field is to be filled with two constant email address which do not change.

For the life of me I have not been able to get this to work after looking at other discussions.

I'm hoping someone might be able to help me out with this one.  Thanks in advance!! 

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
April 12, 2016

You can do it using this code:

var fields = ["Checkbox101", "Checkbox102", "Checkbox103", "Checkbox104"];

var addresses = [];

for (var i in fields) {

    var v = this.getField(fields).valueAsString;

    if (v!="Off") addresses.push(v);

}

this.mailDoc({cTo: addresses.join(";"), cCc: "fixed1@server.com;fixed2@server.com", cSubject: "Subject line goes here"});

RockieMB
RockieMBAuthor
Participant
April 13, 2016

Thanks try67, this is coming up with a

TypeError: this.getHield(fields is null

9: Field: Mouse Up

Any suggestions? Thanks!

try67
Community Expert
Community Expert
April 13, 2016

That means one of the field names is incorrect. Double-check them, and make sure that they appear in the script EXACTLY as they do in the Properties of your fields, including any spaces, upper/lower case letters, special characters, etc.