• Hello, 3 hours i try to execute my function on submit.
    I add this code in function.php and it doesn’t word.
    Please help my i’m totally blocked
    Thanks ??

    function redirectionFormulaire() {
    console.log(“YESSSSSSSSSSSSS”);
    }
    add_action( ‘wpcf7_submit’, ‘redirectionFormulaire’ );

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @kzou13,

    Please read the article DOM events to learn more about the types of custom DOM events Contact Form 7 provides.

    Best regards,
    Yordan.

    Thread Starter kzou13

    (@kzou13)

    Thank you, I tried this, it works but I would like to use one php function.

    Is it possible to execute php function with this ?
    Thank you Yordan

    document.addEventListener( ‘wpcf7submit’, function( event ) {
    if ( ‘123’ == event.detail.contactFormId ) {
    alert( “The contact form ID is 123.” );
    // do something productive
    }
    }, false );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Execute php function on submit’ is closed to new replies.