Title: Conditional Redirection not working
Last modified: January 24, 2020

---

# Conditional Redirection not working

 *  [marcosant](https://wordpress.org/support/users/marcosant/)
 * (@marcosant)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/conditional-redirection-not-working/)
 * I’m trying to make a conditional redirection for my contact form so that depending
   on the item chosen in a select input it redirects to a certain page. I’ve tried
   many versions of this code but none of it works, the email is sent but it just
   refresh the page.
 * document.addEventListener( ‘wpcf7mailsent’, function( event ) {
    if ( ‘2421’ 
   == event.detail.contactFormId ) { var selectedHome = document.getElementById(“
   selectHome”).value;
 *  if (selectedHome == “1”) {
    location = ‘<url1>’; } else if (selectedHome == “
   2”) { location = ‘<url2>’; } } }, false );

Viewing 1 replies (of 1 total)

 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/conditional-redirection-not-working/#post-12363488)
 * Where can we see the website?

Viewing 1 replies (of 1 total)

The topic ‘Conditional Redirection not working’ 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/)

 * 1 reply
 * 2 participants
 * Last reply from: [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/conditional-redirection-not-working/#post-12363488)
 * Status: not a support question