Support » Plugin: Contact Form 7 » donwload pdf file after contactform 7 submisson

  • i use the following code in my functions php to reach a download after contact form 7 submission. but it is not working

    //contact form 7 Download white paper//

    add_action( ‘wp_footer’, ‘redirect_cf7’ );

    function redirect_cf7() {
    ?>
    <script type=”text/javascript”>
    document.addEventListener( ‘wpcf7mailsent’, function( event ) {
    if ( ‘4265’ == event.detail.contactFormId ) { // Sends sumissions on form 4265 to the first thank you page
    location = ‘/wp/wp-
    content/uploads/2018/06/file.pdf’;
    } else if ( ‘4266’ == event.detail.contactFormId ) { // Sends submissions on form 1070 to the second thank you page
    location = ‘/wp/wp-
    content/uploads/2018/06/file2.pdf’;
    }
    else {
    //do nothing
    }
    }, false );
    </script>
    <?php
    }
    You have any ideas why it does not work?

    best regards

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘donwload pdf file after contactform 7 submisson’ is closed to new replies.