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
Posted by William Gill on March 26, 2008, 10:15 am
Please log in for more thread options
I have a simple registration form that needs a binary answer (one or the
other) in several places, using radio buttons. Since at least one radio
button in a group should be checked initially, and I don't want it to
default to either, I am using a third option as the default (checked).
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?

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.


Posted by Beauregard T. Shagnasty on March 26, 2008, 10:34 am
Please log in for more thread options
William Gill wrote:

> I have a simple registration form that needs a binary answer (one or
> the other) in several places, using radio buttons. Since at least
> one radio button in a group should be checked initially, and I don't
> want it to default to either, I am using a third option as the
> default (checked). 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?

Yes. You still need to test in the action script.

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

Why can't you simply use two buttons, with neither hidden and neither
selected as "checked"? Such as:

<input type="radio" name="q1" value="ayup">&nbsp;Yes<br>
<input type="radio" name="q1" value="nope">&nbsp;No

Have your action script test for one being selected, and if not, return
to the form.

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

Posted by William Gill on March 26, 2008, 10:56 am
Please log in for more thread options
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.

>

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

Posted by Jonathan N. Little on March 26, 2008, 12:03 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.
>
>>
>
>> 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.

Drop list box? Ain't pretty but would satisfy your situation

<select name="permission">
<option value="">Please Select</option>
<option value="ayup">Yes</option>
<option value="nope">No</option>
</select>

--
Take care,

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

Posted by William Gill on March 26, 2008, 1:10 pm
Please log in for more thread options
Jonathan N. Little wrote:
> Drop list box? Ain't pretty but would satisfy your situation
>
> <select name="permission">
> <option value="">Please Select</option>
> <option value="ayup">Yes</option>
> <option value="nope">No</option>
> </select>
>

Same "trinary" approach with a "don't accept this one" default, but if I
"hide" the default, it seems to make more sense to the user who only see
two acceptable choices.


<label style="visibility:hidden">Select One <input name="Permission"
type="radio" value="unanswered" checked></label>
<label>Yes<input name="Permission" type="radio" value="yes"></label>
<label>No<input name="Permission" type="radio" value="no"></label>

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