Title: Conditional Redirect
Last modified: December 14, 2017

---

# Conditional Redirect

 *  Resolved [anjanphukan](https://wordpress.org/support/users/anjanphukan/)
 * (@anjanphukan)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/conditional-redirect-11/)
 * Is there any chance that we can add a conditional redirect based on whether a
   checkbox is checked or not?

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

 *  Plugin Contributor [Yuval](https://wordpress.org/support/users/yuvalsabar/)
 * (@yuvalsabar)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/conditional-redirect-11/#post-9784409)
 * Hi [@anjanphukan](https://wordpress.org/support/users/anjanphukan/),
 * Thank you for the idea. We do not plan on adding such feature in the near future,
   as we are trying to avoid adding too many features to the plugin, keeping it 
   simple as that. but perhaps in future updates we will take it under consideration.
   Meanwhile, note you can do that by adding a script to the scripts textarea, that
   is if you have some coding knowledge. Please see my answer [here](https://wordpress.org/support/topic/request-for-multiple-external-redirects/#post-9763546)
   regarding a `select` field. You should take a similar approach using checkbox\
   radio buttons.
 *  Thread Starter [anjanphukan](https://wordpress.org/support/users/anjanphukan/)
 * (@anjanphukan)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/conditional-redirect-11/#post-9784812)
 * Thank you so much for writing back to me. I solved it with the following code:
 *     ```
       <script>
       document.addEventListener( 'wpcf7mailsent', function( event ) {
       if (document.getElementById('textboxId').value != '') {
           location = 'http://www.example.com';
       }
       }, false );
       </script>
       ```
   
 * But I had to use a different plugin to write the code in the footer of the website.
   For some reason the code within the script area in your plugin didn’t work for
   me.
 * But I appreciate your reply. All the best.
 *  [fastasleep](https://wordpress.org/support/users/fastasleep/)
 * (@fastasleep)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/conditional-redirect-11/#post-9784859)
 * You’re basically bypassing the plugin altogether then. See this thread where 
   I figured out how to intercept the URL and alter it:
    [https://wordpress.org/support/topic/append-cf7-form-value-as-variable-to-redirect-url-on-submit/](https://wordpress.org/support/topic/append-cf7-form-value-as-variable-to-redirect-url-on-submit/)
 * Try something like this maybe:
 *     ```
       if ( form.use_external_url && form.external_url ) { 
       	if (document.getElementById('textboxId').value != '') {
           form.external_url = 'http://www.example.com';
       }
       }
       ```
   

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

The topic ‘Conditional Redirect’ is closed to new replies.

 * ![](https://ps.w.org/wpcf7-redirect/assets/icon-256x256.gif?rev=3416723)
 * [Redirection for Contact Form 7](https://wordpress.org/plugins/wpcf7-redirect/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpcf7-redirect/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpcf7-redirect/)
 * [Active Topics](https://wordpress.org/support/plugin/wpcf7-redirect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpcf7-redirect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpcf7-redirect/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [fastasleep](https://wordpress.org/support/users/fastasleep/)
 * Last activity: [8 years, 6 months ago](https://wordpress.org/support/topic/conditional-redirect-11/#post-9784859)
 * Status: resolved