submit form on radio button click
843840Apr 23 2008 — edited Apr 29 2008Hi,
I am trying to submit the form using the radio button. There are 2 radio buttons, radio1 and radio2. Initially when the page is loaded, by default I am checking radio2 button.
So the problem is when I click on the radio button, radio1, then the page is submited and depending on the value of the button, results are shown but on the page it shows that radio2 button is checked instead of radio1. This could be because on page load by default I am checking radio2. So could anyone suggest, when I click on radio1 button and the page is submitted, the results are shown along with radio1 button is selected.
Here is the code:
<script language="Javascript" >
function radioActionU() {
document.all.sysType[0].checked = true ;
document.all.sysType[1].checked = false ;
}
function radioActionX() {
document.all.sysType[0].checked = true ;
document.all.sysType[1].checked = false ;
}
</script>
<BODY onload="document.all.sysType[1].checked" >
<html:form method="post" action="/Stats.do" name="sStats" type="com.SysStatsForm" >
<html:radio property="sysType" value="U" onclick="sStats.submit();radioActionU(); "/>UI
<html:radio property="sysType" value="X" onclick="sStats.submit(); radioActionX();"/>Ext
.....