Buy Now
Sign in

Same as demo Event Switch but on selecting an option (without submit button)

SAGO , October 27 2017
Answered
S
SAGO
Hi,

In the demo Event Switching there is a "product selection" dropdown with 3 choices(first product, second product, third product) and a submit button.
In the Setup there is a Event Switcher in the Submit event.

Is it possible to remove (or hide the submit) and make this work by just selecting one of the options.
So when you select an option, you will be redirected (depending of the choice thanks to the Event Switcher).


ps: I'd like to do it with radio buttons but if it works with the dropdown from the demo, it will work for the radio buttons too. I'll just have to make sure, nothing is selected by default.
admin
Hi SAGO,

This will need a few lines of custom javascript code, in the radios events use "on selecting" "value" and set the action to "function", set the element identifier to "redirect" then add a custom "JavaScript" element and use this code:

function redirect(){
window.location = "http://www.google.com";
}


Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
S
SAGO
Thank you Max!!!

That worked!

I used the following code because I wanted to submit the form so that the submit-button can be removed.
This might maybe help some who wants to do use radiobuttons, dropdowns,... without a submit-button.

function redirect(){
document.forms[0].submit();
}


If there is a better way to do it, don't hesitate to correct this.

Thank you again!

Cheers
admin
This code
document.forms[0]

references the first form on the page, you can instead get the form by its id or class:
jQuery("#form_id")


Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!