D
D
Denis2021-07-10 17:15:56
WordPress
Denis, 2021-07-10 17:15:56

Wordpress contact form 7 submitting when checkbox is selected?

Hello, help with the decision in which direction to move? I've already broken my head.

there is a form on the site with two text fields name and text, it has 4 checkboxes phone, telegram, whatsapp, email, question?
how can I make it so that when choosing one of the checkboxes, there were different actions, if I chose the phone, then just the form was sent, if telegrams then the person is transferred after sending the form via the link to telegrams, vatsap is also via the link to vatsap, but email is needed to an autoresponder was sent to the person, which I already set in the admin panel, how to do it?

The site itself residenciaespanola.ru/vnzh-bez-prava-na-rabotu form individual calculation g1t.ru/video/chrome_rxDup3pO4r.png Tell

me where you can read or how to implement ATP?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vova, 2021-07-11
@vova87

1. create the wpcf7_before_send_mail hook
2. define the form and what data is filled in it.
3. Depending on the data filled in (phone, telegram, vatsap, email), perform the desired action.

D
Denis, 2021-07-12
@Fetfurmoz

Here I found a solution that can be useful to someone, through Hook Vladimir gave a tip. https
://help-wp.ru/contact-form-7-wpcf7_before_sen...

document.addEventListener('wpcf7mailsent', function(event) {
        if ('22' == event.detail.contactFormId) {
            if ($('#mc2 ').is(":checked")) {
                location = 'https://t.me/residenciaes';
            } else if ($('#mc3 ').is(":checked")) { 
                location = 'https://wa.me/message/M5CXS2OSK46PD1';
            }
        }
    }, false);

2 checkboxes redirect after sending, and 2 by default just send

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question