- From: Jukka K. Korpela <jkorpela@cs.tut.fi>
- Date: Thu, 24 Apr 2008 14:34:32 +0300
- To: "w3-html" <www-html@w3.org>
David Dorward wrote: > The current syntax, which is supported by browsers, is: > > <fieldset> > <legend>Gender</legend> > <input name=gender value=male type=radio id=gender_m> > <label for=gender_m>Male</label> > <input name=gender value=female type=radio id=gender_f> > <label for=gender_f>Female</label> > </fieldset> This is a very, very poor example, because a) it confuses sex with gender b) it does not contain a clear question to be answered (whose "gender"?) c) it lacks an explicit option of not answering at all d) it has no initial (default) value defined e) consequently, depending on the vintage of the specification and the browser, the choice may be defaulted to "Male", so you cannot tell the real males from defaulted males f) it is usually unnecessary for the declared purpose of the form, and hence illegal at least in EU countries, by the directive on protection of personal data, to ask for information like a person's "gender" g) it does not apply the international standard on internal coding of information about a person's sex in data. Then again, it's almost a tradition in HTML specifications to present very, very poor examples. Moreover, the default rendering is typically ( ) Male ( ) Female with no line break, thereby letting stupid males to click on the button _after_ "Male" just because they are, well, careless and stupid. In appropriate markup, the fields would be in separate lines. This could be achieved by using <field> markup that is defined as block-level. Compatibility with existing wowsers would be achievable by taking the precaution of adding a <br> tag. > I don't know any > graphical browser (in common use today) that doesn't extend the click > target of an input onto the label associated with it via the for > attribute. That's definitely an improvement. However, the large majority of forms on existing web pages lacks such markup, so most users probably haven't even noticed the feature. The original sin in this issue is that forms were defined in HTML so that there was no implied association between label texts and input fields and no way to declare it explicitly either. What was souped up later is rather odd and hasn't become popular among authors. And that's no wonder. It's _unnatural_ to have to invent an identifier and to use two attributes to specify a simple relationship. > We already have a generic system for associating labels with form > controls, we don't need a specific one just for radio buttons. The "generic system" requires a new identifier to be invented for each and every input field and two attributes to be written, in addition to adding one markup element, <label>, with no implied ease on styling, so we would really need a better generic system. Actually, it is there, just a) under the grossly misleading name <label> b) with no default rendering as a block. Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/
Received on Thursday, 24 April 2008 11:35:08 UTC