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
---
_______________________________________________
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.