Add/Remove email address via checkbox?

Good afternoon,

I am attempting to do something that may or may not be possible. The ultimate goal is to have a list of people, you can select multiple people, and the contact form will send each of them an email.

My website uses FormIt. My initial idea is to have checkboxes and when the checkbox is selected/unselected, it will adjust the number of people receiving the email

Is this possible to do? Thanks in advance

Maybe this Gist could be a start: https://gist.github.com/Jako/0679e1b23cb8f5c5494c6826eba0f6a9

1 Like

I will look into this solution and report back, it is certainly on the right track. I fear it may not be possible but one idea I am toying with is creating a chunk in the formit hooks and seeing if I can manipulate in that method.

1 Like

So I checked and using chunks will not work.

&emailTo=[[$example]] is a no go, placeholders are looking more likely. Luckily I’m not the first person to have this question but unfortunately this is a tougher problem

1 Like

Do you need the user list to be outputted dynamically, or can you hard-code the options (mailto_user1)?

If dynamically, you may need an extra to get the user list for you.

If you just need a checkbox list of users, and click to send to that group, you would have the option list all first in html for the checkboxes, and then you would need to process that list prior to sending the emails. So, you put the email sending into a posthook, which will process after the variable of emails is determined.

So your form would be for sendToGroup, it processes the form and comes up with an array [$EmailArray], which is passed to formit for the email to be sent.

Maybe I am missing something, I don’t think this is too tough, just make the html form with variables.

You make it sound easy :stuck_out_tongue: I was a full time jr web developer for about 8 months, lost my lead developer, then got shoved in every direction but full time web development and then moved to IT, I’m not a strong developer I must confess so I need a bit of hand holding

I can hard code the email addresses yes.

Thanks for your suggestions, I’ll do my best to sort this out. It’s been taking me quite a while.

1 Like

Every platform has its learning curve, once you get the hang of it its not too hard to work with.

Yeah, set up your checkbox form, and its going to have to save the values into an array of emails.

Then, in the posthook, identify the array as the sendto