Title: on_sent_ok variable
Last modified: September 1, 2016

---

# on_sent_ok variable

 *  [Rob Migchels](https://wordpress.org/support/users/dhrrob/)
 * (@dhrrob)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/on_sent_ok-variable/)
 * Hi there!
 * I’m trying to use Contact Form 7 for some fun experiment, where the user should
   provide their URL and E-mail address.
 * I’ve got the fields set-up like [url] and [email]. Whenever the form is submitted,
   I want to use this code ‘on_sent_ok: “location = ‘[https://a-website.com/?url=%5Burl%5D&#8217](https://a-website.com/?url=%5Burl%5D&#8217);;”‘.
   I quickly noticed however that the additional fields do not go well with the 
   variables, is there a quick fix somewhere for this? 🙂
 * While we are at it, is it possible to change the on_sent_ok target to _blank?
 * Thanks!
 * [https://wordpress.org/plugins/contact-form-7/](https://wordpress.org/plugins/contact-form-7/)

Viewing 1 replies (of 1 total)

 *  [ckone](https://wordpress.org/support/users/ckone/)
 * (@ckone)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/on_sent_ok-variable/#post-7465515)
 * I am not an expert, but I found out that once submit has been pressed, no value
   can be passed to the next step including on_sent_ok.
 * What I did find useful is this:
 * `on_sent_ok: "location = 'http://forwarding-webiste-page/?&' + $('form.wpcf7-
   form').serialize();"`
 * This basically inserts all input values to URL. I would think that you should
   grab url value and use it to redirect (any language you prefer, mine is PHP).
   For example, in “forwarding-website-page” I would write
 *     ```
       <?php
       $urlvariable = $_GET['url'];
       header("location: http://$urlvariable");
       ?>
       ```
   
 * Theoretical, but I think you can get it to work. I also tried
 * `on_sent_ok: "window.open('https://google.com/', '_blank');"`
 * But my browser security stopped the pop-up. I think this is not the desired outcome
   you are looking for. I would not. I design it so that a new tab/window would 
   open and only to find out a browser security stops all my hard work. Not a good
   experience for a visitor I would think. And, that’s not even inserting url value.

Viewing 1 replies (of 1 total)

The topic ‘on_sent_ok variable’ 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/)

## Tags

 * [on_sent_ok](https://wordpress.org/support/topic-tag/on_sent_ok/)

 * 1 reply
 * 2 participants
 * Last reply from: [ckone](https://wordpress.org/support/users/ckone/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/on_sent_ok-variable/#post-7465515)
 * Status: not resolved