Conditional redirect from CF7

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 );

<?php I removed the < at the beginning as I have absolutely no idea how to display JS on here Thanks for your help

Hi @Niall,

Thanks for reaching out.

Regretfully, we don’t offer any support to the issues related to the custom codes and third-party plugins. In this regard, I would suggest you contact the plugin support for further help.
If that does not help you anyway, we recommend you to hire a developer for your further customization.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.