Click to See Complete Forum and Search --> : Form action depending on which radio button is checked


Lotz
09-01-2003, 01:53 PM
Is it possible to have a form perform a different action depending on which radio button is checked?

For example, if I have 2 radio buttons "under 13 years" + "over 13 years", I would like that if under 13 is checked, the action is /cgi-bin/under13.cgi and if over 13 is checked, the action is /cgi-bin/over13.cgi.

It is working with a drop down list, put I would like to put radio button instead.

<SCRIPT LANGUAGE="JavaScript"><!--
function setAction() {
document.form.action = document.form.select.options[document.form.select.selectedIndex].value;
}
//--></SCRIPT>

Could you help me to configure it with radio buttons?

Thanks a lot

ggriffit
09-01-2003, 03:26 PM
Plenty of Javascript sites will provide this information for you, you can do it as part of the event on teh Radio Button (see http://www.dremel.net/webdev/javascript/form_radiobutton.htm) or you can do it as part of the onsubmit event.