Hey guys,
I am trying to make my Contact form redirect to a different URL after submission dependent on the selection in the dropdown.
I am new to Javascript and have cobbled together what I thought should work… but it doesn’t :’(
Can you tell me where I might be going wrong?
The page the form is on is http://staging.northwestcalligraphers.org.uk/membership-form
The JS I am using is:
add_action( ‘CF7_redirect’ );
function CF7_redirect() {
?>
script type=“text/javascript”>
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
if ( el.name == “menu-subscription-type” ) {
if ( el.value == “Annual Membership (£15)” ) {
location.href = “https://www.paypal.com/webapps/billing/plans/subscribe?plan_id=P-07G76958RV155961YL4ZH7FQ”;
} else if ( el.value == “Joint Membership (£25)” ) {
location.href = “https://www.paypal.com/webapps/billing/plans/subscribe?plan_id=P-15D93552C6827644ML4ZINHA”;
} else if ( el.value == “Junior Membership (£10)” ) {
location.href = “https://www.paypal.com/webapps/billing/plans/subscribe?plan_id=P-05N12302Y0760482JL4ZIUGY”;
}
}, false );