On 22 May 2007, at 20:40:41, Mike at Green-Beast.com wrote:

Steve Green wrote:
No, a form is not a list of form controls [...]

I agree. A form is not a list, nor is it tabular data. I know this was
originally a demonstration to show the lesser of two evils, but evil is evil so less wrong still isn't right. What I don't understand is why there is this exploration of form layout structures to begin with when a form in of
itself is it's own form layout structure. All the needed tools already
exist.

Why is a div needed, for instance, when the fieldset is already a
container -- the proper container I might add -- for these form controls.

While I agree that use of lists, tables or definition lists is mere abuse, a fieldset is for grouping "thematically related controls and labels":
<http://www.w3.org/TR/html4/interact/forms.html#edef-FIELDSET>

So for example, the fields for "forename" and "surname" could be grouped together with a fieldset, but a separate fieldset should be used for those fields related to "billing address", "delivery address" and so forth. Just bundling the entire contents of the form inside a fieldset because it stops the validator whining about the need for a block-level element is itself an abuse of the fieldset element.

Consider a form that asks for name, address, sex and then has an "additional requirements" textarea. While the elements of each of the first three sections could usefully be grouped together with three separate fieldsets, the final textarea isn't in a group of elements; it stands alone, and the use of an element that defines a grouping of related items becomes meaningless. However the spec requires that it be enclosed in a block-level element, and this is when a semantically- neutral div would be useful.

Oh, and what about the submit button - that needs to be wrapped in something block-level too, but for most forms is not part of a group of elements; a div is again perfectly appropriate here.

As an aside, note that screen readers will read the legend of a fieldset before the label of every element in the fieldset, so legends should be kept short and sweet - for example the following HTML:

<fieldset>
<legend>How did you hear about my donkey and its strange fate?</ legend> <label for="heardWeb"><input name="heard" id="heardWeb" type="radio">On the web</label> <label for="heardTv"><input name="heard" id="heardTv" type="radio">On the TV</label> <label for="heardRadio"><input name="heard" id="heardRadio" type="radio">On the radio</label> <label for="heardPaper"><input name="heard" id="heardPaper" type="radio">In the newspaper</label> <label for="heardOther"><input name="heard" id="heardOther" type="radio">Other</label>
</fieldset>

would be presented to a screen reader user as

   "How did you hear about my donkey and its strange fate? On the web"
   "How did you hear about my donkey and its strange fate? On the TV"
"How did you hear about my donkey and its strange fate? On the radio" "How did you hear about my donkey and its strange fate? In the newspaper"
   "How did you hear about my donkey and its strange fate? Other"

which is a lot of times to be asked the same question; so make your legend text as succinct as possible, yet still meaningful when it is used as a prefix in this manner. If a section of the form, properly enclosed in a fieldset, needs a chunk of explanatory text, then find something brief and meaningful for the legend - or even leave the legend empty - and present the explanatory text in a paragraph.

Regards,

Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/





*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to