The old Profox adage that you solve your problem as soon as you hit 'Send' proves true again!
In case any of you find yourself with a similar need, here's a solution that really works. http://www.redhotpawn.com/board/showthread.php?subject=toggle_radiobutton%3A_javascript%3F&threadid=45235 Note: There are a lot of bad (non-working) suggestions on how to do this. And I think I tried them all! The above approach is a more sophisticated technique that works across the latest builds of the big 5 desktop browsers. Malcolm ----- Original message ----- From: "Malcolm Greene" <[email protected]> To: [email protected] Date: Wed, 25 Aug 2010 13:00:42 -0400 Subject: [NF] Toggling a radiobutton control in HTML? OK, I recognize this question is as about [NF] as possible and (hopefully) still not fall into [OT] but I figured what better group of very, very smart people to ask than the Profox community? :) With that mea culpa and genuine flattery out of the way, can any of you help me out with the following challenge? I have a simple group of radio buttons in HTML. <input type="radio" id="id1" name="qyn_1.response" value="1" /> Yes <br /> <input type="radio" id="id2" name="qyn_1.response" value="2" /> No <br /> <input type="radio" id="id3" name="qyn_1.response" value="3" /> N/A <br /> I would like to add an onclick/onchange handler that will toggle a radiobutton if its already selected. In other words, in HTML, once I've selected a radiobutton in a group, there's no way to 'unanswer' my selection other than add a unique radiobutton for an unanswered state. I'm trying to avoid that last solution if at all possible by clearing the button's checked state via an onclick/onchange event. But this doesn't seem to work. I've been googling for a solution via '(clear | toggle) browser radio button' and found several proposed solutions, none of which seem to work for me across any contemporary browser (chrome, ff, ie, opera, safari). Example (verbose if logic intentional for debugging): <script type="text/javascript"> function clear_radio(button){ if (button.checked) button.checked = false; else button.checked = true; return true; } </script> Which gets called like this. <input ... onclick="clear_radio(this)" /> ... This technique does not work with onclick or onchange handlers. Any suggestions on above or recommendations on a good html/javascript forum for this type of question? Thank you, Malcolm --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

