Skip to content

Instantly share code, notes, and snippets.

@aaronsummers
Last active May 16, 2018 07:41
Show Gist options
  • Save aaronsummers/92a287303884d1d515e3bbf81a733991 to your computer and use it in GitHub Desktop.
Save aaronsummers/92a287303884d1d515e3bbf81a733991 to your computer and use it in GitHub Desktop.
Contact form 7 event listeners
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = '<?php echo site_url('/success/')?>';
}, false );
document.addEventListener( 'wpcf7submit', function( event ) {}
/*
List of Contact Form 7 Custom DOM Events
wpcf7invalid — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because there are fields with invalid input.
wpcf7spam — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because a possible spam activity has been detected.
wpcf7mailsent — Fires when an Ajax form submission has completed successfully, and mail has been sent.
wpcf7mailfailed — Fires when an Ajax form submission has completed successfully, but it has failed in sending mail.
wpcf7submit — Fires when an Ajax form submission has completed successfully, regardless of other incidents.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment