Posts

Showing posts from August 31, 2016

Contact Form 7: Redirecting on a condition in Additional Settings

Image
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 following code: on_sent_ok: "location.replace('http://www.redirectedtopage.com');" 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('type').value=='yes') {location.replace('http://www.redirectedpage1.com') } else { location.replace('http://www.redirectedpage2.com/') }" Or on_sent_ok: "var Iso = $("input[name=radio-option]:checked").val() ; if(Iso == 'General enquiry' ){ location = '/contact/enquiry/thank-general-enquiry/'; } if(Iso == 'Special enquiry' ){ location = '/contact/enquiry/thanks-special-enquiry/'; } if(Iso == 'Interest enquiry' ){ location = '/contact/enquiry/th