Contact Form 7 — adding cc: conditional logic

[ad_1]

there’s a site with a contact form made in Contact Form 7 with a dropdown select for local chapters of the organisation.
I was asked to add logic to the form so that, when a specific local chapter is selected, the resulting form email is (sent to the main contact address, and) cc:’d to the local chapter. I found plugins that add conditional logic, but that is mostly limited to showing/hiding form fields.

I can add javascript to the page, of course, what I’d need is something along the lines of:
\- the submit button is clicked (and the form is validated) — some event fires

\- script reads the value from the select

\- matches it to the corresponding email address

\- alters email headers so that it’s cc:’d to the local chapter address

\- continue the actual sending

now I’ve looked into the CF7 docs but apparently:

1. the DOM events provided by CF7 don’t seem to include anything *before* the actual form sending, closest being *wpcf7submit* that fires after the actual AJAX request has fired — too late, bc the request should include the computer cc: address
2. the additional headers where the cc: value should go, is apparently not reachable via js, nor its value can be apparently modified via (for example) a hidden field (my reasoning being: on select change, value for cc: address goes into an hidden field and from there into the headers)

Any ideas? I’d rather not reinvent the wheel on this

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer