[whatwg] Errormessages in forms
ian at hixie.ch
Tue Dec 2 02:31:07 PST 2008
On Tue, 11 Nov 2008, Oldřich Vetešník wrote:
> Dne Mon, 10 Nov 2008 21:50:37 +0100 Ian Hickson <ian at hixie.ch> napsal/-a:
> > >
> > > <label for="idfield">Instructions</label>
> > > <input name="idfield" id="idfield">
> > > <hint for="idfield">Type in dd-mm-yyyy format</hint>
> > > <error for="idfield">Must be a valid value</error> (if error is true)
> > This seems excessively complicated and I'm not convinced there is
> > really a problem to solve here. Just using plain text seems enough.
> Indeed it seems enough. Although this kind of solution could improve
> Screen Readers' abilities to effectively interpret forms.
> It could be finally clear how to code it right for both web developers
> and Screen Reader developers how (& what) to implement (I'm guessing
> here, I don't know how difficult it would be to implement such
> behavior). Nowadays, all kinds of hints & errors are outside the label
> element thus sreen readers don't read them out. That's bad. This could
> improve the forms & feedback accessibility in general.
> I'm not saying this is the best solution, if you have another, please
> share. I'm proposing those changes because current situation is horrible
> and nobody really knows how to code it right.
Well, in the snippet above, the following seems adequate:
<label> Instructions <input name=idfield>
Type in dd-mm-yyy format</label>
...and the custom error message should be set from script, using
addCustomValidity(). How is that not accessible? It seems fine to me. The
AT can read the whole label when entering the field, and the error message
handling is done by the UA.
> An example: I'm sort of disgussed when I see how Zend Framework
> implements default form element wrapper-tags: dt's for labels, dd's for
> inputs and ul li's for errors. I think form elements (labels, inputs...)
> are not meant to be used in a definition list (because they aren't),
> errors (mostly one-line) are not meant to be in a list. Such abuse of
> html! Yes of course everyone does it differently, but I think people
> tend to do those kind of "evil" things when they don't have enough
> semantic tags to use.
That seems like an extreme case where even having the elements wouldn't
really help that much.
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg