i have currently 3 checkboxes.
But the thing is i only want 2 of them to b processed i.e

if check box 1 is checked then the 2 one must get blocked thus by preventing the user to check it.
similarly vice versa.
(this must be applied only to 1st 2 check boxes not the 3rd one )

Is there ne way to do it dynamically....?

9 Years
Discussion Span
Last Post by almostbob

leviathan is right, this would be easiest to do with a simple javascript function:

function disableCheckBox(checkbox1, checkbox2)
if (document.getElementById(checkbox1).checked == true)
document.getElementById(checkbox2).disabled = true;
} else {
document.getElementById(checkbox2).disabled = false;

and then for your checkboxes:

<input type="checkbox" id="chk1" onchange="disableCheckBox('chk1','chk2')" />
<input type="checkbox" id="chk2" onchange="disableCheckBox('chk2','chk1')" />

y can't use two radio buttons and one check box which is disabled

Votes + Comments
apology for repeating your answer

Well i am complete navie in the field of java scripting ....
But seems like i have no choice but to learn it.

<label for='this'>related this </label><input type='radio' id='this' name='oneonly' value='single'><br>
<label for='that'>related that </label><input type='radio' id='that' name='oneonly' value='double'><br>
<label for='unrelated'>unrelated</label><input id='unrelated'type='checkbox' name='unrelated' value='lots'>

no javascript required

**edit** sorry Manuz, just read posts and saw your prior answer

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.