Title: Redirect code for specific form
Last modified: September 14, 2017

---

# Redirect code for specific form

 *  [Ricky55](https://wordpress.org/support/users/ricky55/)
 * (@ricky55)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/redirect-code-for-specific-form/)
 * Hi
 * I have the js that you provide on this page working
 * [https://contactform7.com/redirecting-to-another-url-after-submissions/](https://contactform7.com/redirecting-to-another-url-after-submissions/)
 * But I have two forms. One for my contact page and one for a registration page.
   I only need the redirect on the registration page and not on the contact page.
   Is there a way to redirect just for a specific form?
 * Thanks in advance.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fredirect-code-for-specific-form%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [miggy0212](https://wordpress.org/support/users/miggy0212/)
 * (@miggy0212)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/redirect-code-for-specific-form/#post-9498381)
 * Hi Ricky55!
 * <script type=”text/javascript”>
    document.addEventListener( ‘wpcf7mailsent’, 
   function( event ) { if ( ‘123’ == event.detail.contactFormId ) { // First Form
   location = ‘[http://example.com/&#8217](http://example.com/&#8217);; } else if(‘
   123’ == event.detail.contactFormId ) { // SecondForm location = ‘[http://example.com/&#8217](http://example.com/&#8217);;}},
   false ); </script>
 *  Thread Starter [Ricky55](https://wordpress.org/support/users/ricky55/)
 * (@ricky55)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/redirect-code-for-specific-form/#post-9498987)
 * Thanks man!! Sorry for if this is a silly question but can I ask.
 * The 123 what will be substituted with?
 * Also my second form just wants to exhibit normal behaviour so how can I say if
   it’s this form do nothing effectively?
 * Thanks
 *  [miggy0212](https://wordpress.org/support/users/miggy0212/)
 * (@miggy0212)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/redirect-code-for-specific-form/#post-9505120)
 * Just replace the “123” with the form ID
 * Then if you only want to redirect the first form then just use this one instead:
 * <script type=”text/javascript”>
    document.addEventListener( ‘wpcf7mailsent’, 
   function( event ) { if ( ‘123’ == event.detail.contactFormId ) { location = ‘
   http://example.com/’; } }, false ); </script>
 * I hope it helps!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Redirect code for specific form’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [miggy0212](https://wordpress.org/support/users/miggy0212/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/redirect-code-for-specific-form/#post-9505120)
 * Status: not resolved