shnplr
10-23-2010, 07:51 AM
Dear experts,
I want a control which allows zero or one selection from many options. For example on a Declaration page of a web form I ask such question as:
"Have you had any convictions for other offences?" [yes] [no]"
In this case I require the user to physically select Yes or No.
The closet control that fits this specific case is, I think, Radio button; however unlike some other UI's the HTML specification http://www.w3.org/TR/html401/interact/forms.html#radio infers a default option should always be checked.
In fact most (all?) browsers allow "no default" - and since I doubt it's a bug in all browsers it seems clear to me having no default is considered valid by ui designers - I've read arguments about the "No answer" option however in this case I wish to avoid a 3rd option. I've also no problem being unable to deselect a radio button once selected; this is fine, consistent and desireable behaviour in this case.
For the requirement of a "zero or one of many" radio control; can I simply add a hidden "default" option?
<input type="radio" name="decl-other" value="true">Yes</input>
<input type="radio" name="decl-other" value="false">No</input>
<span id="decl-other-default" style="visibility:hidden;">
<input type="radio" name="decl-other" value="undefined" checked="checked"> </input>
</span>
The approach seems to fit both my requirement AND adhere to the spec (which doesn't explicitly state the element must be visible). Would this be a valid solution/workaround?
Unfortunately, I dont know how to test it! - is anyone aware of a browser which follows the spec and defaults one of the radio buttons...? Is this even an issue or just a moot point?
Thanks in advance for any comments or insight,
I want a control which allows zero or one selection from many options. For example on a Declaration page of a web form I ask such question as:
"Have you had any convictions for other offences?" [yes] [no]"
In this case I require the user to physically select Yes or No.
The closet control that fits this specific case is, I think, Radio button; however unlike some other UI's the HTML specification http://www.w3.org/TR/html401/interact/forms.html#radio infers a default option should always be checked.
In fact most (all?) browsers allow "no default" - and since I doubt it's a bug in all browsers it seems clear to me having no default is considered valid by ui designers - I've read arguments about the "No answer" option however in this case I wish to avoid a 3rd option. I've also no problem being unable to deselect a radio button once selected; this is fine, consistent and desireable behaviour in this case.
For the requirement of a "zero or one of many" radio control; can I simply add a hidden "default" option?
<input type="radio" name="decl-other" value="true">Yes</input>
<input type="radio" name="decl-other" value="false">No</input>
<span id="decl-other-default" style="visibility:hidden;">
<input type="radio" name="decl-other" value="undefined" checked="checked"> </input>
</span>
The approach seems to fit both my requirement AND adhere to the spec (which doesn't explicitly state the element must be visible). Would this be a valid solution/workaround?
Unfortunately, I dont know how to test it! - is anyone aware of a browser which follows the spec and defaults one of the radio buttons...? Is this even an issue or just a moot point?
Thanks in advance for any comments or insight,