scripts – Contact Form 7 Redirect to different URL on form submit depending upon dropdown select

[ad_1]

I’m utilizing this code for dropdown menu in Contact Form 7:

[select* menu-student id:menustudent include_blank "Student" "Professional"]

I need if one select Student, then after form submission, it will redirect to the scholar web page and if one select Professional, it will go to the skilled web page after form submission.

I’ve used this code as talked about right here.

This is the code I’ve added:

<script>
inputs = event.detail.inputs;
inputs.forEach( perform(el) {
    if ( el.identify == 'menu-scholar' ) {
        if ( el.worth == 'Student' ) {
            location.href="https://google.com";
        } else if ( el.worth == 'Professional' ) {
            location.href="https://facebook.com";
        }
    }
});
</script>

But it’s not redirecting for me.

Can somebody please level me the place I’m doing incorrect?

I’ve also used the below script with out any consequence:

document.addEventListener( 'wpcf7submit', perform( event ) {
  var lpLocation =  document.getElementById("menustudent").worth;
  if (lpLocation == "Student") {
    location = 'https://facebook.com/';
  } else if (lpLocation == "Professional") {
    location = 'https://google.com/';
  }
}, false ) 

Any assist appreciated.

[ad_2]
Source link

Leave a Reply