WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Contact Form 7] Redirect to Thank you page on submit (23 posts)

  1. docop29
    Member
    Posted 4 years ago #

    I would like to have Contact Form 7 redirect my users to a new page after they submit, but I don't see any evident way of doing that. Any suggestions? Thanks.

    http://wordpress.org/extend/plugins/contact-form-7/

    http://thestartupexperiment.com/

  2. nuovohost
    Member
    Posted 4 years ago #

    I would also want something like the above.....redirecting the form submitter to a new page saying "thank you for submitting your query."

    Can anyone help us figure that?
    Thanks in advance.

  3. fastestmanalive
    Member
    Posted 4 years ago #

    add this to the "additional settings" section:

    on_sent_ok: "location.replace('http://www.YOURSITE.com');"

  4. nuovohost
    Member
    Posted 4 years ago #

    @fastestmanalive
    thank you very much for the reply.
    I'm using "contact form 7" with folioelements theme.

    Site: http://99tutorials.com/restaurant1/
    The problem is when I use the contact form (located at the top right hand, of the site) and hit the submit button, it redirects to a new page (simple page and not consistent with the current theme) with a message at the bottom saying "your message has been sent".

    Or, like when I'm leaving any required field empty it redirects to a page (simple page) saying "the required field is empty".

    I'm not a PHP expert or something like that, and when I looked into the "additional settings" section, I found the following code:

    function additional_setting( $name, $max = 1 ) {
    $tmp_settings = (array) explode( "\n", $this->additional_settings );

    $count = 0;
    $values = array();

    foreach ( $tmp_settings as $setting ) {
    if ( preg_match('/^([a-zA-Z0-9_]+)\s*:(.*)$/', $setting, $matches ) ) {
    if ( $matches[1] != $name )
    continue;

    if ( ! $max || $count < (int) $max ) {
    $values[] = trim( $matches[2] );
    $count += 1;
    }
    }
    }

    return $values;
    }

    I'm not sure where to put the code, you mentioned.
    Also the page location,
    the contact form redirects to, is following:

    http://99tutorials.com/restaurant1/wp-content/themes/folioelements/ajax/pageloader.php?pagename=contact#wpcf7-f1-p35-o1

    Any idea what should I do?

    Thanks in advance for your help.

  5. uniglobalindia
    Member
    Posted 4 years ago #

    fastestmanalive! Thanks a ton buddy, your post helped me and contact form 7 redirect works perfectly fine

    on_sent_ok: "location.replace('http://www.YOURSITE.com');"

  6. paulodef
    Member
    Posted 4 years ago #

    Well,
    It doesn't work for me... or I don't know how to do it well.
    I just have to copy-paste this line:

    on_sent_ok: "location.replace('http://www.YOURSITE.com');"

    in the text area "Aditional settings" of the admin.

    and it is supposed to redirect the confirmation message to a new page?

    Merci!

  7. rosebean
    Member
    Posted 4 years ago #

    Same problem.... didn't work for me either. Any help?

  8. archondigital
    Member
    Posted 4 years ago #

    doesn't seem to work anymore

    any ideas?

  9. jabrams
    Member
    Posted 4 years ago #

    It works for me in Mozilla Firefox but in IE it doesn't...any suggestions?

  10. ReneeRox
    Member
    Posted 4 years ago #

    I tried adding this code to the "Additional Settings" and nothing happend. Did the new update to the plugin remove this capability? Honesly, I dont see why this isn't a standard feature of this plugin.

  11. jabrams
    Member
    Posted 4 years ago #

    We use the Contact Form 7 Plugin on our site for various things, including an RSVP form for our events. At the end of all our forms, our members click submit and it takes them to a new page where they have the option to pay via PayPal. I inserted the on_sent_ok: "location.replace('http://www.YOURSITE.com');" code into the additional settings section, and it works just fine in Firefox but not at all in IE for all my forms. To combat this, I changed the "Sent Successfully" box to "If this page does not redirect, please click here, with a link to my redirect page. Two of our forms work just fine, with the page redirecting in Firefox and the link to click here showing up in IE, but we're having trouble with one of them and it's compatibility in IE.

    When our members click on the Submit button in IE, it submits all information to us, but instead of redirecting them to selected page on our website to pay through PayPal, a new page opens and it says Not Found: Sorry you are looking for something that isn't here. In FireFox, however, once a member clicks the submit button, it submits all the information and redirects them to the appropriate page.

    My website is http://www.rmpca.com and the problem exists under my RSVP page: http://rmpca.com/events/rsvp/

    I've tried all I can think of in terms of troubleshooting. I have deleted and redone my RSVP page, I have deleted and redone my form. Nothing seems to be working. In designing the website, I have often run into compatibility problems with IE, which is frustrating since most of my members use this browser.

    Any help or suggestions you have is appreciated!

  12. jcstewart
    Member
    Posted 4 years ago #

    Which version are you using? i am currently using contact form7 Version 2.1

    I will like to know how to redirect to a thank you page or even better a paypal payment link

  13. jcstewart
    Member
    Posted 4 years ago #

    [SOLUTION]

    This solution applies for the the latest version to date contact form 7 2.1

    Open "contact-form-7/scripts.js"

    and edit the lines to reflect the following..

    if (data.onSentOk)
    jQuery.each(data.onSentOk, function(i, n) { eval(n) });
    if(document.location == "http://sitename.com/donations/"){
    location.href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=xxxxxx";
    }

    Work nicely for me if you need further info contact me at clivestewart@hotmail.com
    I will be happy to assist you

  14. Manzana
    Member
    Posted 4 years ago #

    Any advice for multiple forms on your website and how to redirect them to different pages?

  15. djones101
    Member
    Posted 4 years ago #

    Some help would be great...

  16. jalancast
    Member
    Posted 4 years ago #

    If you've added the code

    on_sent_ok: "location.replace('http://www.YOURSITE.com');"

    to the "additional settings" area of Contact Form 7 and it's not working, take a moment to see if your theme calls the wp_footer function in the footer.php theme file.

    Contact Form 7 loads the Javascript responsible for the redirect in the footer. If your theme doesn't include the <?php wp_footer(); ?> line, the Javascript will never load...and the redirect won't work.

  17. jtdesign00
    Member
    Posted 4 years ago #

    Beautiful! Thanks guys!

    What about if you have separate forms that you wish to redirect to separate pages. Example: form1 redirects to form1-thanks and form2 redirects to form2-thanks

    Thanks in advance!

  18. carlitosWP
    Member
    Posted 4 years ago #

    I got mine to work. I was wondering if there was a way to make the page an _blank page. In other words to open up a new page instead of redirecting.

    Thanks!

  19. carlitosWP
    Member
    Posted 4 years ago #

    I answered my own question:

    on_sent_ok: window.open('http://dude.org', '_blank');

  20. superiorinternet
    Member
    Posted 3 years ago #

    This worked for me
    In the scripts.js in the contact form 7 folder look for

    if (1 == data.mailSent)
    This is line 116 in the current version

    then add the following code after the jquery code
    location.href="http://www.yourdomain.com/thankyou/";

    so the final code would look like this

    if (1 == data.mailSent) {
    		jQuery(data.into).find('form').resetForm().clearForm();
    		location.href="http://www.yourdomain.com/thankyou/";
    		wpcf7ResponseOutput.addClass('wpcf7-mail-sent-ok');

    Hope this helps!

  21. Tifa
    Member
    Posted 3 years ago #

    Hey guys,

    I read the docs and I found this:
    http://contactform7.com/2010/03/27/redirecting-to-another-url-after-submissions/

    simple solution and it works!

  22. Kishore Murthy
    Member
    Posted 3 years ago #

    The thank you page redirect does not work when the contact form 7 is used in a custom field that has short code enabled.

  23. Kishore Murthy
    Member
    Posted 3 years ago #

    Correction. I was able to make it work by adding <?php wp_footer(); ?> to my page template.

Topic Closed

This topic has been closed to new replies.

About this Topic