On Sent Ok DOM Events for Multiple Forms
-
I see in your support article how to add DOM events to replace my on sent ok rule in Additional Settings. However, the example below 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?
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
}
In this case, the ga() function will be executed only if the ID of the contact form (event.detail.contactFormId) is “123”.The page I need help with: [log in to see the link]
- The topic ‘On Sent Ok DOM Events for Multiple Forms’ is closed to new replies.