• I’m trying to make a conditional redirection for my contact form so that depending on the item chosen in a select input it redirects to a certain page. I’ve tried many versions of this code but none of it works, the email is sent but it just refresh the page.

    document.addEventListener( ‘wpcf7mailsent’, function( event ) {
    if ( ‘2421’ == event.detail.contactFormId ) {
    var selectedHome = document.getElementById(“selectHome”).value;

    if (selectedHome == “1”) {
    location = ‘<url1>’;
    } else if (selectedHome == “2”) {
    location = ‘<url2>’;
    }
    }
    }, false );

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Conditional Redirection not working’ is closed to new replies.