Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Radio button with no default
Old 10-26-2010, 05:59 AM Radio button with no default
Banned

Posts: 408
Name: mushget
Trades: 0
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?
Code:
<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">&nbsp;</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,
mushget is offline
Reply With Quote
View Public Profile Visit mushget's homepage!
 
 
Register now for full access!
Old 10-26-2010, 09:21 AM Re: Radio button with no default
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
you don't really need the span to hide the extra radio button.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Radio button with no default
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 2.48545 seconds with 12 queries