Support » Plugin: Contact Form 7 » [Plugin: Contact Form 7] Conditional redirect

  • Resolved MarkeyMark


    I’m using the on_sent_ok action in ‘Additional Settings’ to redirect to a payment page.

    I would like to use a conditional redirect that directs the user different pages depending on whether a checkbox/radio button has been selected.

    I’ve looked at the post by ckpicker who appears to be asking a similar question, however the code that has been used in his post displays an alert on the screen rather than redirecting to alternative pages.

    I’d really appreciate some assistance with this.

    Thanks in advance.

    [ Please do not bump, that’s not permitted here. ]

Viewing 3 replies - 1 through 3 (of 3 total)
  • OK, I’ve done a little digging & I’ve come up with this code:

    on_sent_ok: “if (jQuery(“#payment-type”).value() == “Invoice”) {location.replace(‘’);}”

    The email submission works, but unfortunately the redirect doesn’t work at all now.

    Is it possible do to a conditional redirect with CF7 or do I need to look for an alternative method?


    The code you need to add into the “Additional Settings” is as follows:

    on_sent_ok: ” if (document.getElementById(‘paymenttype’).value==’Invoice’) {location.replace(‘’)} else { location.replace(‘’) } “

    ‘paymenttype’ is the ID set on a drop-down menu & ‘Invoice’ is one of the selectable values.

    Hope this helps somebody!!

    Hey MarkeyMark!

    Thanks for the code. I’m still having a problem with the conditional redirect; both options linked to the 2nd URL.
    Radio Button choices: Paypal, Bank Transfer

    I put this code in the additional settings, but it always leads to Google page instead of Paypal.
    on_sent_ok: ” if (document.getElementById(‘paymentmode’).value==’Paypal’) {location.replace(‘’)} else { location.replace(‘’) } “

    Any fix? 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Contact Form 7] Conditional redirect’ is closed to new replies.