I am doing a survey using the plugin "Contact Form 7". I want to insert an acceptance box. ONLY if people check this box and click "submit", they should be redirected to another page, where I am going to ask for their e-Mail-addresses.

If they don't check "acceptance" there should be no redirecting.

How can I do this?

I ready inserted on_sent_ok: "location = "" - BUT: This ignores if the acceptance box is check or not.

3 Answers 3


I found an answer myself:

Redirecting without a condition When you use the Wordpress plugin “Contact Form 7” you can redirect the user to another page after submitting the answers by the follwing code:

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

The line of code you have to copy into the “settings” box at the end of a specific form you created.

Redirecting on a condition If you want to make the redirecting depending on a specific answer, you can use the following code:

on_sent_ok: " if (document.getElementById('car').value=='yes') {location.replace('http://www.redirectedpage1.com')} else { location.replace('http://www.redirectedpage2.com/') } "

The code in bold letters has to be changed by your settings.

For example: The question with the id “car” has two possible answers: “Yes” or “No”. If a person selects “Yes” he or she should be redirected to “http://www.redirectedpage1.com”. If “No” is selected, the user should be redirected to “http://www.redirectedpage2.com/”.


Just write the code into additional setting of contact from 7 as bellow :

on_sent_ok: "var Iso = $("input[name=radio-565]:checked").val() ; if(Iso == 'value1' ){ location = 'www.example.com'; } if(Iso == 'value2' ){ location = 'www.example2.com'; }"

input[name=radio-565] = radio button name
value1 = radio button 1st value 
value2 = radio button 2nd value 
  • 1
    Please don't just post a code, try to add some explanation - how the code is working. Mar 2, 2014 at 8:04

Maybee this helps:


here on submit event you can check if acceptance imput is checked and then redirect them with

window.location = 'http://example.com/your-another-page';

Not the answer you're looking for? Browse other questions tagged or ask your own question.