Click here to get back home

radio button question

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
radio button question William Gill 03-26-2008
Get Chitika Premium
Posted by Beauregard T. Shagnasty on March 26, 2008, 12:57 pm
Please log in for more thread options
William Gill wrote:

> Beauregard T. Shagnasty wrote:
>
>> Yes. You still need to test in the action script.
>
> Or in the cgi that processes the data, but I have to do that anyway.

Yes, that would be the script called by the form's action attribute.

>> Why can't you simply use two buttons, with neither hidden and neither
>> selected as "checked"? Such as:
>
> Per the spec (html401 17.2.1 Control types), "At all times, exactly
> one of the radio buttons in a set is checked. If none of the <INPUT>
> elements of a set of radio buttons specifies `CHECKED', then the user
> agent must check the first radio button of the set initially."
>
> In the past I have had problems with different browsers complying to
> varying degrees, and I don't want an inadvertent default to give me
> permission the used didn't intend.

I've an internal CMS that I use for doing input and data entry for a few
sites. In the pages to choose which record to edit, I have:

<input type="radio" name="radio1" value="Edit">Edit &nbsp;&nbsp;
<input type="radio" name="radio1" value="Add new">Add New&nbsp;&nbsp;
<input type="radio" name="radio1" value="Delete"> Delete

..and in none of my numerous browsers is there a 'default' marked by
those browsers. This makes me think none of the UAs pay attention to the
rule you stated.


--
-bts
-Motorcycles defy gravity; cars just suck

Posted by William Gill on March 26, 2008, 1:18 pm
Please log in for more thread options
Beauregard T. Shagnasty wrote:

> I've an internal CMS that I use for doing input and data entry for a few
> sites. In the pages to choose which record to edit, I have:
>
> <input type="radio" name="radio1" value="Edit">Edit &nbsp;&nbsp;
> <input type="radio" name="radio1" value="Add new">Add New&nbsp;&nbsp;
> <input type="radio" name="radio1" value="Delete"> Delete
>
> ..and in none of my numerous browsers is there a 'default' marked by
> those browsers. This makes me think none of the UAs pay attention to the
> rule you stated.
>

I used to do the same thing, not specifying which is initially checked,
until I ran into some problems, but it was a very long time ago. It may
be safer now.



Posted by Jonathan N. Little on March 26, 2008, 2:59 pm
Please log in for more thread options
William Gill wrote:
> Beauregard T. Shagnasty wrote:
>
>> I've an internal CMS that I use for doing input and data entry for a few
>> sites. In the pages to choose which record to edit, I have:
>>
>> <input type="radio" name="radio1" value="Edit">Edit &nbsp;&nbsp;
>> <input type="radio" name="radio1" value="Add new">Add New&nbsp;&nbsp;
>> <input type="radio" name="radio1" value="Delete"> Delete
>>
>> ..and in none of my numerous browsers is there a 'default' marked by
>> those browsers. This makes me think none of the UAs pay attention to the
>> rule you stated.
>>
>
> I used to do the same thing, not specifying which is initially checked,
> until I ran into some problems, but it was a very long time ago. It may
> be safer now.
>
>

But that is relying on an undefined behavior, usually a bad thing with
computers, I remember the old segmented memory wrap around hack that
programmers used that broke when the 286 came around... Will's got a
point, what if a browser that doesn't follow the current convention
becomes popular?

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Posted by Beauregard T. Shagnasty on March 26, 2008, 4:44 pm
Please log in for more thread options
Jonathan N. Little wrote:

> William Gill wrote:
>> Beauregard T. Shagnasty wrote:
>>> I've an internal CMS that I use for doing input and data entry for a
>>> few sites. In the pages to choose which record to edit, I have:
>>>
>>> <input type="radio" name="radio1" value="Edit">Edit &nbsp;&nbsp;
>>> <input type="radio" name="radio1" value="Add new">Add New&nbsp;&nbsp;
>>> <input type="radio" name="radio1" value="Delete"> Delete
>>>
>>> ..and in none of my numerous browsers is there a 'default' marked by
>>> those browsers. This makes me think none of the UAs pay attention
>>> to the rule you stated.
>>
>> I used to do the same thing, not specifying which is initially
>> checked, until I ran into some problems, but it was a very long time
>> ago. It may be safer now.
>
> But that is relying on an undefined behavior, usually a bad thing
> with computers, I remember the old segmented memory wrap around hack
> that programmers used that broke when the 286 came around... Will's
> got a point, what if a browser that doesn't follow the current
> convention becomes popular?

But should it matter? One of the radio buttons must be selected in any
case. Ok, I'll concede: if Firefox 7.0.23 shows one of them checked by
default, I'll alter my strategy. ;-)

--
-bts
-Friends don't let friends drive Vista

Posted by Jukka K. Korpela on March 26, 2008, 5:44 pm
Please log in for more thread options
Scripsit William Gill:

> I have a simple registration form that needs a binary answer (one or
> the other) in several places, using radio buttons.

For a binary choice, a single checkbox is often preferable, though then
you need a useful, meaningful default choice, and you won't be able to
distinguish between users who skipped the question and users whose
answer coincides with the default. It's still probably the best approach
for things like

[ ] You may pass my contact info to advertizers.

where an explicit permission by the user is required anyway (assuming we
want to act morally and, in many countries, by the law).

There's also the possibility of using a text input box, e.g.

<div><label>Sex (M for male, F for female):
<input type="text" name="sex" size="1"></label></div>

This makes the form a bit faster to fill out, for people who know how to
work with the keyboard. Admittedly, clickable buttons might be what most
of the clicking generation is accustomed to. But they still have to use
the keyboard for text input, and maybe they'll learn some day that for a
form, keyboard-only use is normally best. But I digress.

> Since at least
> one radio button in a group should be checked initially,

Yes. Maybe I need to point to my document on choices in forms, since the
discussion has shown that this is not clear to all:
http://www.cs.tut.fi/~jkorpela/forms/choices.html

> and I don't
> want it to default to either, I am using a third option as the
> default (checked).

Fine, though sometimes it would make sense to have a fourth option as
well, so that you have two normal choices, the preselected choice
indicating that the question has not been answered yet, and a selectable
choice saying "Don't want to answer".

> Rather than have that third option say something
> like "you must pick one of the other two", I am styling it as hidden
> like this:
> <label style="visibility:hidden">Huh!<input name="Permission"
> type="radio" value="Huh!" checked ></label>
>
> Does anyone see any unintended consequences to doing it this way?

Well, it looks odd when CSS is off. To begin with, the text precedes the
button, against the de facto standard, and the text looks odd. Remember
the CSS Caveats.

But if you write the entry in a manner that makes sense when presented
to the user, e.g.

<div style="visibility:hidden"><label><input name="Permission"
type="radio" value="Huh!" checked >Not answered yet</label></div>

then I don't see any _big_ problems with it. But it would probably be
better without the CSS code for hiding it.

> I realize that once they check either one of the visible options they
> can't get back to the default, but that's really what I want.

What if they make a choice, then realize that they don't really
understand the question or definitely don't want to answer? They have
the option of not submitting the form at all. Do you want to give them
also the option of submitting it with some part intentionally left
unfilled, perhaps with some explanation given by them in a textarea?

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


Similar ThreadsPosted
set radio button color October 5, 2005, 7:22 am
Select a radio button have another value passed on also in form- How? October 26, 2004, 12:25 pm
making an image part of the Radio button November 22, 2007, 11:43 am
What would cause radio buttons to not be clickable? May 1, 2006, 3:56 pm
Multiple groups of radio buttons with same name? September 30, 2004, 7:32 am
style.display & visibility on checkbox/radio in Mac IE July 26, 2005, 12:06 am
5 Sure Fire Ways To Get Radio Play For Your "Independent" Music! January 29, 2008, 11:29 pm
CSS for a mac button September 21, 2005, 10:23 am
JPG needs refresh button to appear September 13, 2004, 4:21 pm
JPG needs refresh button to appear September 13, 2004, 4:21 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap