• hello! I am using this snippet for redirect to diferents thank you pages depend on dropdown selection.

    It works fine. But it is sending when the user doesn′t check required fields.

    Do you know how can I fix it?
    Thank you

    document.addEventListener( ‘wpcf7submit’, function( event ) {
    if ( ‘116’ == event.detail.contactFormId ) {
    var selection = document.getElementById(“selection”).value;

    if (selection == “Problem”) {
    location = ‘page1’;
    } else if (selection == “Colaboration”) {
    location = ‘page2’;
    }
    else if (selection == “Suges”) {
    location = ‘page3’;
    }
    else if (selection == “Consult”) {
    location = ‘page4;
    }
    }
    }, false )

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Because you use the wpcf7submit event. See https://contactform7.com/dom-events/

    Thread Starter lauramark

    (@lauramark)

    O_O

    But I change the event and the work is the same ??

    I am trying it 2 days :_(

    Thread Starter lauramark

    (@lauramark)

    @takayukister, please, please where is the fail.

    Thread Starter lauramark

    (@lauramark)

    With this code, it doesn′t work

    Is possible to do it by other way?

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

    if (selection == “Problem”) {
    location = ‘page1’;
    } else if (selection == “Colaboration”) {
    location = ‘page2’;
    }
    else if (selection == “Suges”) {
    location = ‘page3’;
    }
    else if (selection == “Consult”) {
    location = ‘page4;
    }
    }
    }, false )

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Redirect pages with validity form’ is closed to new replies.