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

Comments

Popular posts from this blog

PHP: Date Difference for PHP 5.2

HTML5 video loop src change on end play function

display the_content with setup_postdata