Search code examples
wordpresscontact-form-7hidden-field

How can i show a different message in cf7 email?


Good afternoon to all, I'm a newby of this site and programming. I'm working on my first web local site, and I'd like to place a dropdown menu in a Contacf form 7. So i try to explain which results I'd like. In this dropdown menu I have 4 choice and id like to receive in the email an additional text for every choice. example drop down menu: Cats Dogs Elephant Lion

so in the email that I'll receive, if I chose cats, I want also the text "small place" if I choose dog "medium place" and so on. What can I do to have this results? sorry for my bad English and thanks in advance for every answer


Solution

  • You can use CF7 Conditional Fields for that

    or

    You can insert a hidden input and with some js/jquery you can fill that input with a value based on selected option.

    $('#selectid').on('change', function() {
      if($('#selectid').val() == "text"){
        $('#inputId').val('insert text');
      }
    });
    

    and then you can put your hidden input in mail template.

    Update:

    Here is the right code based on your needs: jsfiddle