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

SAGO 27 Oct, 2017
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.
Max_admin 28 Oct, 2017
Answer
1 Likes
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
SAGO 30 Oct, 2017
1 Likes
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
Max_admin 01 Nov, 2017
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.