• Since 5.4 the form does not send or redirect to the thank-you page the js error I receive is TypeError: Cannot set property ‘innerText’ of null.

    This happens when the recaptcha is active if I deactivate the recaptcha it will send but then still doesn’t redirect to the thank you page. There is also no little ajax spinning wheel when you hit the send button. I reverted back to 5.3.2 and everything works as it should. Any ideas on how to fix this I have about 20 plus sites using your plugin and I don’t really want to revert all of them back.

Viewing 3 replies - 16 through 18 (of 18 total)
  • @thenewguy_14 Redirection is done via JavaScript. Can you see any console messages related to this?

    Thread Starter Wildcard

    (@thenewguy_14)

    Hey @galbaras yeah I add the script to my footer through the wp_footer hook in my function file.

    add_action( 'wp_footer', 'contact_form_redirect_submit' );
    
    function contact_form_redirect_submit() {
    	?>
    	<script type="text/javascript">
            document.addEventListener( 'wpcf7mailsent', function( event ) {
                if ( event.detail.contactFormId === '96' ) {
                    location = '/thank-you/';
                }
                if( event.detail.contactFormId === '95'  ) {
                    location = '/reservation-request-sent/';
                }
    
            },false );
    	</script>
    	<?php
    }
    ?>

    And it was working with 5.3.2 but now is not working with 5.4 I might just disable the recaptcha and use a quiz input to deter spam but not sure if that would be enough to stop spam from coming through.

    Can you see any console messages related to this?

    Can you please check this.

    Also, your code seems OK, although it uses relative URLs. Perhaps you should try using absolute ones, e.g. location = '<?php esc_url( home_url( '/thank-you/' ) ); ?>';

    Another thing you can do is examine event.detail with console.log, just to see what you’re actually getting.

    • This reply was modified 3 years, 8 months ago by Gal Baras.
Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Contact form doesn’t send’ is closed to new replies.