Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

closed as off-topic by birgire, toscho Jul 26 at 9:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers 3

up vote 1 down vote accepted

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/”.

share|improve this answer

Maybee this helps:

http://drzaus.com/snippet/wordpress-is-contact-form-7-missing-on_submit-callback

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';
share|improve this answer

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 
share|improve this answer
1  
Please don't just post a code, try to add some explanation - how the code is working. –  Mayeenul Islam Mar 2 at 8:04

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