Wednesday, August 31, 2016

Contact Form 7: Redirecting on a condition in Additional Settings

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('');"

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') 
} else { location.replace('') }"


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/thanks-interest-enquiry/'; }"

No comments:

Post a Comment