in reply to How to uncheck one checkbox if some other is checked
This is a question more suitable for a javascript group. And I would still urge you to drop those CGI helpers and write raw HTML. Then you would fit into a web developer group and get (hopefully) good help from there.
Aaanyway, if you are willing to ignore the cosmetic aspects, you would be better off doing this in your submission code (you need to prioritise the "E" checkbox over the others.) You will need to deal with it in the submission code anyway. There might be other checkboxes checked even if the "E" one is already checked.
Anyway, the javascript-osmosis person that I am, here seems to be a workable function. I honestly don't know if it is in any way cross-browser compatible or anything.
function toggleOther (elName, ignore) { var buttons = document.getElementsByName(elName); var disable = false; if (ignore.checked) { disable = true; } for (var i = 0; i < buttons.length; i++) { if (buttons[i] == ignore) { next; } buttons[i].disabled = disable; } }
And it is called like this:
<input type="checkbox" name="GRU$Za" value="E" onclick="toggleOther('G +RU$Za', this)" />
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to uncheck one checkbox if some other is checked
by Anonymous Monk on Aug 09, 2012 at 21:19 UTC | |
by SerZKO (Beadle) on Aug 10, 2012 at 05:53 UTC | |
by Anonymous Monk on Aug 10, 2012 at 06:46 UTC | |
|
Re^2: How to uncheck one checkbox if some other is checked
by SerZKO (Beadle) on Aug 10, 2012 at 08:10 UTC | |
by Anonymous Monk on Aug 10, 2012 at 09:31 UTC |