I am sending the code of the file.Here the problem is that when I open the file,then both radio buttons are active.I want that when I open the file only one radio button is active.I know this will be done by "checked". But here I am using onChange=submit.When Page refreshes then the value which was first selected should remain same as selected before.I need help in this matter.Plz provide answer as early as possible. Again understand that after reshing the page which radio button was selected should remain selected after onChange=submit. Thanx
<%@ page import="
java.sql.*,
java.io.*,
java.util.*
"%>
<head>
</head>
<body bgcolor="#005B00" topmargin="0" leftmargin="0">
<Script Language="JavaScript">
function func(){
mydate=new Date();
document.Tahir1.T2.value=mydate.getMonth()+"/"+mydate.getDate()+"/"+mydate.getYear()+'\t'+mydate.getHours()+":"+mydate.getMinutes()+":"+mydate.getSeconds();;
}
window.setInterval("func()");
function dis(){
if(document.Tahir1.R1[0].checked){
document.Tahir1.R1[0].checked=true;
document.Tahir1.D6.disabled=false;
document.Tahir1.D7.disabled=true;
document.Tahir1.D8.disabled=true;
document.Tahir1.D7.value="";
document.Tahir1.D8.value="";
}
if(document.Tahir1.R1[1].checked){
document.Tahir1.R1[1].checked=true;
document.Tahir1.D6.disabled=true;
document.Tahir1.D6.value="";
document.Tahir1.D7.disabled=false;
document.Tahir1.D8.disabled=false;
}
}
</script>
<table border="0" width="100%">
<tr>
<td width="100%"><img border="0" src="../PICS/LOGO.png" width="666" height="100"></td>
</tr>
</table>
<table border="0" width="100%">
<tr>
<td width="100%" bgcolor="#C0C0C0"><font color="#0000FF" face="Arial">Here
You Can Register The New Indoor Patient</font></td>
</tr>
</table>
<table border="0" width="100%">
<tr>
<td width="100%">
<form name=Tahir1 method="POST" >
<table border="0" width="100%" height="568">
<tr>
<td width="19%" bgcolor="#C0C0C0" align="right" height="25">
<p align="right"><font face="Arial">Reg No</font></td>
<td width="19%" bgcolor="#C0C0C0" align="right" height="25">
<p align="left">
<%
try{
session = request.getSession(true);
String A=(String)session.getAttribute("logon.isDone");
if(A!=null){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc
dbc:Hospital");
Statement s=con.createStatement();
ResultSet result=s.executeQuery("select MAX(cast(replace(ID,'IN-','')as numeric))from
test where ID like 'IN_%'");
while(result.next()){
String S3=result.getString(1);
if(S3!=null){
int I=Integer.parseInt(S3);
I=I+1;
out.println("<input type=text name=T1 disabled=true size=20 value=IN-"+I+">");
}
if(S3==null){
out.println("<input type=text name=T1 size=20 value=IN-1>");
}
}
}catch(Exception e){}
}
if(A==null){
session.setAttribute("login.target",HttpUtils.getRequestURL(request).toString());
response.sendRedirect(request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + "/Home.html");
return;
}
}catch(Exception e){}
%>
</td>
<td width="19%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Reg
Date/Time</font></td>
<td width="18%" bgcolor="#C0C0C0" align="right" height="25">
<p align="left"><input type="text" name="T2" disabled="true" size="20"></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Name</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25">
<p align="left"><input type="text" name="T3" size="20"></p>
</td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">NIC#</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T4" size="20"></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Sex</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><font face="Arial"><input type="text" name="T5" size="20"></font></td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">DOB</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T6" size="20" value="mm/dd/yyyy"></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Address</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T7" size="20"></td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">City</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T8" size="20"></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Phone</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T9" size="20"></td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Mobile</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T10" size="20"></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Present
Disease</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T11" size="20"></td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Medicine Taken</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T12" size="20"></td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0" align="right" colspan="4" height="20">
<p align="left"><font face="Arial" color="#0000FF">History Related
Information</font></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Blood
Pressure</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T13" size="20"></td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Blood
Group</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><select size="1" name="D1">
<option selected></option>
<option value="A+">A+</option>
<option value="A-">A-</option>
<option value="B+">B+</option>
<option value="B-">B-</option>
<option value="AB+">AB+</option>
<option value="AB-">AB-</option>
</select></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Weight</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T14" size="5"><font face="Arial">in
<b>kg</b></font></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Diabetes</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><select size="1" name="D2">
<option selected></option>
<option>YES</option>
<option>NO</option>
</select></td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Heart
Disease</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><select size="1" name="D3">
<option selected></option>
<option>YES</option>
<option>NO</option>
</select></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Smoker</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><select size="1" name="D4">
<option selected></option>
<option>YES</option>
<option>NO</option>
</select></td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Drinker</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><select size="1" name="D5">
<option selected></option>
<option>YES</option>
<option>NO</option>
</select></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="108"><font face="Arial">More
History (if any)</font></td>
<td width="75%" bgcolor="#C0C0C0" colspan="3" height="108"><textarea rows="5" name="S1" cols="47"></textarea></td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0" align="right" colspan="4" height="20">
<p align="left"><font face="Arial" color="#0000FF">Allocation of
Ward Bed or Room </font></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="20">
<p align="right"><b>Room Booking</b></p>
</td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="20">
<p align="left">
<%
try{
session = request.getSession(true);
String A=(String)session.getAttribute("logon.isDone");
if(A!=null){
String J[]=new String[2];
try{
out.println("<input type=radio value=V1 name=R1 on Click ()=dis()></td><td width=25% bgcolor=#C0C0C0 align=right height=20><p align=right><b>Ward Bed Booking</b></td><td width=25% bgcolor=#C0C0C0 align=right height=20><p align=left><input type=radio name=R1 value=V2 on Click ()=dis()></td></tr><tr><td width=25% bgcolor=#C0C0C0 align=right height=20><font face=Arial>Room No:</font></td><td width=25% bgcolor=#C0C0C0 align=right height=20><p align=left><select size=1 name=D6>");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc
dbc:Hospital");
Statement s=con.createStatement();
ResultSet result=s.executeQuery("select Room_Id from Room_Master");
while(result.next()){
String S3=result.getString(1);
if(S3!=null){
out.println("<option>"+S3+"</option>");
}
if(S3==null){
out.println("<option>Empty</option>");
}
}
out.println("</select></td><td width=25% bgcolor=#C0C0C0 align=right height=20><font face=Arial>Ward ID</font></td><td width=25% bgcolor=#C0C0C0 align=right height=20><p align=left>");
out.println("<select size=1 name=D7 onChange=submit()>");
Statement s1=con.createStatement();
ResultSet result1=s1.executeQuery("select Ward_Id from Ward_Master");
String lastCountry = request.getParameter("D7");
while(result1.next()){
String S3=result1.getString("Ward_Id");
out.println("<option ");
if(S3.equals(lastCountry)){
out.println("selected");
}
out.println(" value='"+S3+"'>"+ S3+"</option>");
}
out.println("</select></td></tr><tr><td width=50% bgcolor=#005B00 align=right colspan=2 height=20> </td><td width=25% bgcolor=#C0C0C0 align=right height=20><font face=Arial>Bed No:</font></td><td width=25% bgcolor=#C0C0C0 align=right height=20><p align=left>");
out.println("<select size=1 name=D8 on Click ()=dis()>");
Statement s2=con.createStatement();
ResultSet result2=s2.executeQuery("select Bed_Id from Bed_Master where Ward_Id = '" + request.getParameter("D7") + "'");
while(result2.next()){
String S3=result2.getString(1);
if(S3!=null){
out.println("<option>"+S3+"</option>");
}
if(S3==null){
out.println("<option>Empty</option></select>");
}
}
out.println("<tr><td width=100% bgcolor=#C0C0C0 align=right colspan=4 height=20><p align=left><font face=Arial color=#0000FF>Attendant Information</font></td></tr><tr><td width=25% bgcolor=#C0C0C0 align=right height=25><font face=Arial>Att_ID</font></td><td width=25% bgcolor=#C0C0C0 height=25>");
Statement s5=con.createStatement();
ResultSet result5=s5.executeQuery("select MAX(cast(replace(Att_Id,'Att-','')as numeric))from Attendent where Att_Id like 'Att_%'");
while(result5.next()){
String S3=result5.getString(1);
if(S3!=null){
int I=Integer.parseInt(S3);
I=I+1;
out.println("<input type=text name=T15 disabled=true size=20 value=Att-"+I+">");
}
if(S3==null){
out.println("<input type=text name=T15 size=20 value=Att-1>");
}
}
}catch(Exception e){}
}
if(A==null){
session.setAttribute("login.target",HttpUtils.getRequestURL(request).toString());
response.sendRedirect(request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + "/Home.html");
return;
}
}catch(Exception e){}
%>
</td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Att_Name</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T16" size="20"></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Att_Address</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T17" size="20"></td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Att_City</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T18" size="20"></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Att_Phone</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T19" size="20"></td>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Att_Mobile</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T20" size="20"></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" align="right" height="25"><font face="Arial">Relation With Patient</font></td>
<td width="25%" bgcolor="#C0C0C0" height="25"><input type="text" name="T20" size="20"></td>
</tr>
<tr>
<td width="25%" bgcolor="#C0C0C0" height="27"> </td>
<td width="50%" bgcolor="#C0C0C0" height="27" colspan="2">
<p align="center"><font color="#005B00"><input type="submit" value="Save" name="B1" style="font-size: 1em; font-family: Arial"></font></p>
</td>
<td width="25%" bgcolor="#C0C0C0" height="27"> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
[ April 18, 2006: Message edited by: Bear Bibeault ]