Thread Starter
RusseWeb
(@tatianapesnya)
davmerit thank you for your advice.
But I already saw this page and I use Pipes in my drop-down menu. Thanks to Pipes, I can add several addresses to my drop-down menu list.
BUT
I need to choose between two drop-down menu lists (they contain different email adresses). And that choice depends on the radio buttons selection.
Thread Starter
RusseWeb
(@tatianapesnya)
I would work but probably not in my case.
It seems like I cannot validate the form without choosing an option in both drop-down lists because they both contain email adresses (pipe method)…
Grrrr, such a difficult task !
This sort of conditional logic is not available directly in Contact Form 7. It can be done via custom programing but you would need to be rather skilled at WordPress development using PHP and/or jQuery.
Some of the premium Form plugins do offer some Conditional Logic including Gravity Forms and Ninja Forms.
Thread Starter
RusseWeb
(@tatianapesnya)
Thank you davmerit.
I will send this question to Gravity Forms. I’ll write there if they answer.
V B
(@vaishalibansal)
Hi
I am having the same problem.
My problem is, that i have designed two emails.
radio button : direct bank transfer|info@domain.com
paypal|info@domain.com
Now i want to send two separate emails to the info@domain.com based on the option selected.
Eg: if direct bank is selected, email ‘i am bank transfer’ should be sent and vice versa.
But it is sending both emails.
Here is my code:
[radio radio-530 id:rad-show default:1 "Direct Bank Transfer|info@domain.com" "Paypal|info@domain.com"]
Please advise
Thanks
There are 2 ways to do this,
- Client side: use a hidden field for the recipient email. You can use the CF7 Hidden field plugin to create a hidden field. Add a jquery script in your form that triggers when your radio button is selected, something along the lines of.
$(document).ready(function() {
$('input[type=radio][name=editOrPub]').change(function() {
if (this.value == 'Editor') {
$('input.email-recipient').value='editor.magazine@gmail.com';
}
else if (this.value == 'Publicity') {
$('input.email-recipient').value='pub.magazine@gmail.com';
}
});
});
where your radio button name is editOrPub
, and your hidden field has a class attribute email-recipient
.
- Server side: using the CF7 hook
wpcf7_before_send_mail
as explained in this online tutorial. In the tutorial they talk about creating a plugin, but you can just as well put the functionality in your theme’s function.php
file.
Good luck.