Hi
I need help...
I am working with a form redirect and js.
I am trying to redirect from a form to one of three URL's through a radio button selection.
Each radio has code to direct to the URL. An example is <input type="radio" class="start_form_button_space" name="sorting" onsubmit="usePage(this, 'sorting');return checktheform();" value="form_1b.php">. So there are three radio choices, but this is one set of radio button, and the value= in each radio is the defining factor to identify the redirect. For example:
Javascript code to make the redirection is here:
Code:
<script type="text/javascript">
function usePage(frm,nm){
for (var i_tem = 0, sorting=frm.elements; i_tem < sorting.length; i_tem++)
if(sorting[i_tem].name==nm&&sorting[i_tem].checked)
frm.action=sorting[i_tem].value;
}
</script>
The form i am using so far looks like this:
Code:
<form class="form" action="#" method="post" >
<fieldset>
<legend>Search: </legend>
<input type="hidden" id="hma97177niw" name="redirect" value="http://www.somesite.com/">
<br>
<table>
<tr>
<td width"105px" align="left" >some name 1</td>
<td width="5px" align="right"><input type="radio" class="start_form_button_space" name="sorting" onsubmit="usePage(this, 'sorting');return checktheform();" value="form_1b.php"></td>
<td width"105px" align="left" >some name 2</td>
<td width="5px" align="right"><input class="start_form_button_space" type="radio" name="sorting" onsubmit="usePage(this, 'sorting');return checktheform();" value="form_2b.php"></td>
</tr>
<td width"215px" align="right" colspan="3"><br>Advanced Search</td>
<td width="5px" align="right" colspan="1" ><br><input class="start_form_button_space" type="radio" name="sorting" onsubmit="usePage(this, 'sorting');return checktheform();" value="index-2.php"></td>
</tr>
</table>
<br>
<input type="submit" value="Continue">
</fieldset>
</form>
So far it doesn;t work. Does anyone see have ideas on to help?
Thanks in advance
Steve
Bookmarks