Billybonga
IS-IT--Management
I have a form of 3x3 radio buttons.
I want to select button Column1/Row1 and have all other buttons in Column1 disabled and all other buttons left unchecked.
I have come up with the following:
html
Things are working correctly i.e. I select R1_1, then R2_1 and R3_1 become disabled, R1_2 and R1_3 become unchecked (if they had already been checked.)
Now if I select R1_2 it unchecks R1_1 and R1_2 and disables R2_2 and R3_2 but yet R2_1 and R3_1 still remain disabled??
Play around with the above code and you will see what I mean - now although I code programme all these possibilities then it could be vast and head=aching -- is there any way to make this easier ??
I want to select button Column1/Row1 and have all other buttons in Column1 disabled and all other buttons left unchecked.
I have come up with the following:
Code:
<SCRIPT LANGUAGE="JavaScript">
function Disab (val) {
if(val=="11")
{form1.r1_1.disabled=false;
form1.r2_1.disabled=true; form1.r3_1.disabled=true;
form1.r1_2.checked=false;form1.r1_3.checked=false}
if(val=="12")
{form1.r1_2.disabled=false;
form1.r2_2.disabled=true; form1.r3_2.disabled=true;
form1.r1_1.checked=false;form1.r1_3.checked=false}
if(val=="13")
{form1.r1_3.disabled=false;
form1.r2_3.disabled=true; form1.r3_3.disabled=true;
form1.r1_1.checked=false;form1.r1_2.checked=false}
if(val=="21")
{form1.r2_1.disabled=false;
form1.r1_1.disabled=true; form1.r3_1.disabled=true;
form1.r2_2.checked=false;form1.r2_3.checked=false}
if(val=="3")
{form1.r3_1.disabled=false;
form1.r1_1.disabled=true; form1.r2_1.disabled=true;
form1.r3_2.checked=false;form1.r3_3.checked=false}
}
</SCRIPT>
html
Code:
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="post" action="">
<p>
<input type="radio" name="r1_1" value="3" onClick="Disab (11)">
<input type="radio" name="r1_2" value="2" onClick="Disab (12)">
<input type="radio" name="r1_3" value="1" onClick="Disab (13)">
<BR>
<BR>
<input type="radio" name="r2_1" value="3" onClick="Disab (2)">
<input type="radio" name="r2_2" value="2">
<input type="radio" name="r2_3" value="1">
</p>
<p>
<input type="radio" name="r3_1" value="3" onClick="Disab (3)">
<input type="radio" name="r3_2" value="2" disabled>
<input type="radio" name="r3_3" value="1" disabled>
</p>
</form>
</body>
</html>
Things are working correctly i.e. I select R1_1, then R2_1 and R3_1 become disabled, R1_2 and R1_3 become unchecked (if they had already been checked.)
Now if I select R1_2 it unchecks R1_1 and R1_2 and disables R2_2 and R3_2 but yet R2_1 and R3_1 still remain disabled??
Play around with the above code and you will see what I mean - now although I code programme all these possibilities then it could be vast and head=aching -- is there any way to make this easier ??