Contact Form 7 Thank You page after submit

Contact Form 7 did not supported loading a Thank You page after the user clicks Submit. (As of Aug. 2009)

Here is a way to force Contact Form 7 to load a custom page after the user submits the form:
(note that it will change the submit form results for every contact form on the website, until code is added to the javascript to handle multiple Contact Forms on one WordPress website)

Edit this file: /wp-content/plugins/contact-form-7/contact-form-7.js
line: 91 add one line here, immediately after the code:

    if (1 == data.mailSent) {

add this:

location.href="http://mywebsite/my-thank-you-page/";

7 Comments

  1. Andrew says:

    Just what I was looking for – thank you

  2. Ben says:

    For Contact Form 7 (2.1.2)

    I got my form to redirect to a thank you page by using this:

    on_sent_ok: “document.location = ‘http://www.ebay.com'”

    change ebay to your thank you page.

  3. sen says:

    cihuyy !!!
    tanx :)

  4. Warren G says:

    The simplest way is using on_sent_ok JavaScript action hook. By using this hook, you can specify a JavaScript code that you wish to run after the form is successfully submitted. You will find the Additional Settings field at the bottom of the contact form management page. Simply insert the following line into it:

    on_sent_ok: “location = ‘http://example.com/’;”

    found here: http://contactform7.com/2010/03/27/redirecting-to-another-url-after-submissions/

  5. Hello! Nice advice, but I would like to add that this can also be achieved Without editing the plugin’s js file, but adding the following in the “Additional Settings” area of your Contact Form :

    on_sent_ok: “window.location=’http://mywebsite/my-thank-you-page/’;”

    keep up the goodness

    – alex

  6. GoogleThem says:

    Consensus amongst our thoughtful commenters is to use the javascript hook on_sent_ok easily supplied by Contact Form 7 with the “additional settings”. Thanks guys!

  7. Roman says:

    Yes! It works, thank you!
    ‘on_sent_ok’ – didn’t want to work.

Leave a comment