• RusseWeb

    (@tatianapesnya)


    Hello,

    I wonder if two conditional parameter can be used with Contact Form 7.
    I have a contact form that can be sent to several email adresses.
    – First the user should choose one option from two radio buttons.
    – Then there will be two menu drop-down lists width different email adresses, each is linked to a radio button.
    – Depending on which radio button were chosen, email adresses in drop-down list will change.

    Example :
    Choose radio button : Editor OR Publicity
    If Editor is chosen list will contain this : Magazine1|editor.magazine@gmail.com and message will be sent to editor.magazine@gmail.com
    If Publicity is chosen list will contain this Magazine1|pub.magazine@gmail.com and message will be sent to pub.magazine@gmail.com

    I am not really good into PHP 🙁
    Thanks for your help,
    Tatiana.

    https://wordpress.org/plugins/contact-form-7/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Selectable Recipient with Pipes might offer a solution.

    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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Send contact form to different email addresses depending on two conditions’ is closed to new replies.