On Sent Ok DOM Events for Multiple Contact Forms
-
Hello Guys,
I am using Contact Form 7 Plugins with multiple contact forms in my website. Recently i have seen something in plugin like Depricated Settings are using in additional settings. So I reached the following link, https://contactform7.com/2017/06/07/on-sent-ok-is-deprecated/
But I saw example code for replacing on_sent_ok with DOM Events. But however that is only for one form. What if I have to set rules for all forms that send users to a confirmation URL? How do I configure this? Do I add more lines beginning with “if” to accommodate all the forms?
Please provide a clean solution for the same. OR Does this plugin helps me to fix the issue? Please help me out.
eg:
add_action( ‘wp_footer’, ‘mycustom_wp_footer’ );
function mycustom_wp_footer() {
?>
<script type=”text/javascript”>
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
if ( ‘123’ == event.detail.contactFormId ) {
location.replace(‘/contact-confirmation’);
}
}, false );
</script>
<?php
}Thanks
- The topic ‘On Sent Ok DOM Events for Multiple Contact Forms’ is closed to new replies.