• I just wanted to share this here, because I scoured the internet for days to figure out an answer to this question, and I hope others find my eventual solution useful.

    I have a dynamichidden field in my form that contained a particular URL. What I wanted to do was redirect the user to that URL once they hit the submit button. Normally you would use this JavaScript in the “Additional Settings” section of the contact form:

    on_sent_ok: "location = 'http://example.com/';"

    But I needed to redirect to a variable URL based on the value of one of the fields on the page. What I ended up using was this, where the ID of the element was “variable-url”:

    on_sent_ok: "var url = document.getElementById('variable-url').value; location = url;"

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

  • The topic ‘How to use a field value for a redirect’ is closed to new replies.