W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2008

[whatwg] Select elements and radio button/checkbox groups [Was: Form Control Group Labels]

From: Markus Ernst <derernst@gmx.ch>
Date: Wed, 29 Oct 2008 10:49:25 +0100
Message-ID: <490831A5.3060703@gmx.ch>
Ian Hickson schrieb:
> On Tue, 28 Oct 2008, Markus Ernst wrote:
[...]
>> I consider a total re-thinking of select, input type="checkbox" and 
>> input type="radio" elements as highly desirable, though I see that this 
>> might cause more serious backwards compatiblity problems than for 
>> example removing the font tag. One possible solution could be using the 
>> select tag with a type attribute:
>>
>> <label for="gender">Gender:</label>
>> <select id="gender" name="gender" type="boxgroup">
>>   <option value=""> </option>
>>   <option value="m">Male</option>
>>   <option value="f">Female</option>
>> </select>
> 
> I don't understand what problem you are trying to solve here.

Changing a group of radio buttons resp. checkboxes into a select 
element, or vice-versa, needs a non-trivial amount of work. This applies 
to both HTML coding and DOM access.

Consider a form with some quite big radio button groups, and now you 
have do add some more options. After you are done, your boss says: "Ok, 
great work... but this looks too ugly now, just change it into those 
dropdown kind of things."

Also, if you want to achieve the same via DOM access requires quite some 
coding amount, you have to build a totally different tree of elements, 
instead of one line:
document.getElementById("gender").type = "dropdown";

> On Tue, 28 Oct 2008, Tab Atkins Jr. wrote:
>> I haven't given it serious thought, but as far as I can tell his 
>> proposed solution (piling all four display types onto the <select> tag) 
>> would work wonderfully as a semantic consolidation/simplification, and 
>> be nicely backwards-compatible.  There are still good reasons to support 
>> keeping the <input> types of radio and checkboxes, of course (frex, 
>> wrapping a form around a list, and putting an <input> within each <li>), 
>> but this proposal would simplify the most common case.
> 
> I don't see what problem this solves. What's wrong with what we have now?

We have similar things treated in different ways.

To illustrate this, have a look unordered and ordered lists, which are 
similar, too. Consider ul and ol would have the same kind of different 
syntaxes; say, the ul element would work like we know it, but to make an 
ordered list we would have to write something like:

<p type="orderedlist">
   <listposition value="list position 1">
   <listposition value="list position 2">
</p>

Now simply changing an ordered into an unordered list would cause an 
annoying amount of re-writing, such as changing a radio button group 
into a select element does.
Received on Wednesday, 29 October 2008 02:49:25 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:06 UTC