Here is simple test Ive been messing around with.
How do I assign the value that was selected in the radio button to a java variable in my JSP here. Javascript being client side and JSPs being serverside makes this difficult.
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function valbutton(thisform)
{
myOption = -1;
for (i=0; i<thisform.myradiobutton.length; i++)
{
if (thisform.myradiobutton.checked)
{
myOption = i;
}
}
if (myOption == -1)
{
alert("You must select a radio button");
return false;
}
alert("You selected button number " + myOption + " which has a value of " + thisform.myradiobutton[myOption].value);
thisform.submit();
}
</SCRIPT>
<title>CreateCategoryContent</title>
</head>
<body>
<BR>
<center>
<%
for(int i = 0; i < 10; i++)
{
%>
<form name="myform">
<table border="1" bordercolor="#C0C0C0" width="50%" cellpadding="0" cellspacing="0" bgcolor="white">
<tr>
<td><%=i%><input type="radio" VALUE="<%=i%>" name="myradiobutton"></td>
</tr>
<%
}
%>
</form>
<input type="submit" name="submitit" onclick="valbutton(myform);return false;" value="Validate" />
</table>
</center>
<!--//T2-->
</body>
</html>
Thanks dudes.