View Full Version : Checkbox enable or disable

06-22-2005, 02:46 PM
Is there a way that I can make one checkbox turn others off? I'm creating a form that has 6 objects. One of these objects is 'None'. Is there a way that if a user selects 'None', they cannot select the other 5 items, essentially making them disabled?

I know that radio buttons would be easier, but they are not as easy to use with our 4D database and web server.

06-22-2005, 04:37 PM

document.getElementById("firstCheckboxsId").checked = false;
document.getElementById("secondCheckboxsId").checked = false;
document.getElementById("thirdCheckboxsId").checked = false;
// &c.

Or, if you gave them numerically-based IDs ("cb_1", "cb_2", "cb_3" &c.) you can use a for loop:

for(i = firstCheckboxToDisable; i < lastCheckboxToDisable + 1; i++)
document.getElementById("cb_" + i).checked = false;