WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Contact Form 7] Issues with ‘Redirecting to Another URL After Submission’

[Plugin: Contact Form 7] Issues with ‘Redirecting to Another URL After Submission’

  • circlecube
    Participant

    @circlecube

    So what is the correct syntax to forward a submitted form to a thank you page? I’ve found half a dozen different ways and none of them seem to work both in IE and FF. Actually only one would work in FF and none in IE that I’ve been able to tell. But now that I’m trying them again none of them work in FF either. I think I’m going crazy.

    The most trustworthy site for reference I would guess would be: http://contactform7.com/2010/03/27/redirecting-to-another-url-after-submissions/ and this it states to use:
    on_sent_ok: “location = ‘http://example.com/’;”

    looking through the forums after this solution didn’t work I found:
    on_sent_ok: “location.href(‘http://example.com’);”
    on_sent_ok: “location.href = ‘http://example.com’;”
    on_sent_ok: “window.location=’http://example.com’;”
    on_sent_ok: “location.replace(‘http://example.com’);”

    The emails still get sent but the redirect does not. But when I put these on_sent_ok lines into the additional settings, the emails are sent but the feedback success message doesn’t show up anymore. Validation error messages do still show up though.

    I’m using the latest version of the plugin (2.2.1) I have taken care to make sure the theme and the page include the wp_footer and have viewed the source on the page containing the form and see the /wp-content/plugins/contact-form-7/scripts.js?ver=2.2.1 file. I love this plugin, but have spent the better part of a full day trying to get this to work. Thought it was fixed once but then I checked the internet exploder and no dice. Any clarification or insights would be greatly appreciated. Thanks!

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

Viewing 15 replies - 1 through 15 (of 24 total)
  • My problem is similar. I had a form with a redirect that was working just fine. However, I upgraded to WordPress 3.0 and upgraded the Contact 7 plugin to 2.2.1 and now the redirect doesn’t work. I get a spinning arrow that just sits there.

    It seems that this is a major bug; we also used the on_sent_ok-Feature and it worked well before upgrading to WP 3.0. When submitting a form, the spinning arrow loads endless, no success-message appears, but the data was sent. When I removed all on_sent_ok commands the form was submitted and cleared, the success-message appears an everything seems to be okay. but this is no solution to me…

    Takayuki Miyoshi
    Participant

    @takayukister

    For WP 3.0 users, try the development version, please. It should have fixed the bug.

    http://downloads.wordpress.org/plugin/contact-form-7.zip

    Sorry for this inconvenience.

    Thanks takayukister it works in WordPress 3.0 now!

    maorb
    Participant

    @maorb

    I have the same problem too, that the redirection won’t work.
    I use WP2.9.2 with latest version of contact form 7.

    I tried all the 4 different syntaxes of the redirection, but nothing works.
    It does send the mail with the form, but no redirection, just the ajax loader animated gif keeps showing.

    I also ofcourse, using the <?php wp_footer();?> in the theme.

    Should I also upgrade to the development version, as I use WP2.9.2 and not 3.0

    Thanks
    Maor

    maorb
    Participant

    @maorb

    Some more info about the problem:

    The page with the currently temp form is :
    http://gilagideon.co.il/?page_id=1642

    When sending the form, firebuging it I see in the POST :

    _wpcf7 2
    _wpcf7_is_ajax_call 1
    _wpcf7_unit_tag wpcf7-f2-p1642-o1
    _wpcf7_version 2.2.1
    accept-mailing-list[]
    cellphone 050-333333
    email-117 a@a.com
    firstanme sss
    lastname 111
    phone 03-33333

    The server response is :

    { “mailSent”: 1, “into”: “#wpcf7-f2-p1642-o1”, “captcha”: null, “message”: “Message sent successfully. Thankx”, “onSentOk”: [“location = \’http://gilagideon.co.il/?page_id=1445/\’;”] }

    I’d like to think I’m just having a blonde day – but after deleting the old version and uploading the redeveloped version, I still can’t get the form to show?

    http://robynbeazley.com/contact/

    It IS working on this site for me with 3.0?? http://copperwest.ca/contact/

    Thanks in advance for your insight.

    Circlecube – looks like you looked into this thouroughly!

    Did you solve it?

    I’m in the same boat (WP 3.0 – need to redirect forms to aa url on send_ok – but two different urls for two different forms).

    I upddated Contact Form 7 plugin to the development version posted by takayukister and it fixed the continually spinning ajax button.

    But I still can’t get a page to redirect 🙁

    However my html is not valid and my custom theme doesnt include wp_footer function it seems so i’ll try those next as per the advice on contactform7.com

    maorb
    Participant

    @maorb

    I use still 2.9.2 but I solved my issue.
    After spending lots of hours with this issue, I discovered that the call to Google’s jQuery 1.4.2 was the source of the problem.
    When removing the call to jQuery, the on_sent_ok started to do the redirection as needed.
    So for the meantime, I added an if statement on my header.php, to exclude the jQuery call if this is the form page, which actually don’t really need the jQuery library in it for me.
    Hope my hours of investigation will help someone here with this issue.

    rwilliams1961
    Member

    @rwilliams1961

    maorb,

    where do you and how do you remove the jquery call?

    thanks.

    yankeyhotel
    Member

    @yankeyhotel

    worked for me tooo!
    yeah. thank you.

    maorb
    Participant

    @maorb

    @rwilliams1961

    I put this if statement in my header.php, inside the <head> section
    I removed for the form page both jQuery and two other js scripts that weren’t needed.
    In my example, the form page id was 1612, just replace the number with your page’s number:

    <?php if (!is_page('1612')) :?>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.cycle.all.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/script.js"></script>
    <?php endif;?>

    Hope it helps for the moment, and hope also that it will be fixed in the CF7 next version, if the plugin’s creator visits this page 🙂

    Greetings everyone!, I updated to the development version and it works in wp3 for me, but what I’m trying to do is this:

    I’ve contactform7 working together with a payment gateway plugin, and once the contact form (that is used as a checkout form) sends the e-mail, I want to redirect my information to another page. The problem is that the redirection cleans all my POST variables and I need to keep them on $_POST…ideas? :-p

    Thanks in advance.
    Christian.

    deewilcox
    Member

    @deewilcox

    I’m having the same issue. My forms send, and the data sends successfully, but I get the spinning arrow and no redirect. I am running WP 3.0 and uploaded the developer version of the plugin. I’ve checked for the AJAX functions in wp_header and wp_footer, and they are both there. I’ve also tried deactivating all other plugins. I’ve also tried adding the code from @maorb above to my header.php file, but it doesn’t seem to have made a difference.

    I appreciate any ideas anyone might have!

    @deewilcox

    When trying my code snippet, have you change the number of the
    (!is_page('1612'))
    to your specified page number that holds the form?

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘[Plugin: Contact Form 7] Issues with ‘Redirecting to Another URL After Submission’’ is closed to new replies.