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

[whatwg] Errormessages in forms

From: Thomas Broyer <t.broyer@gmail.com>
Date: Tue, 22 Jul 2008 16:13:41 +0200
Message-ID: <a9699fd20807220713u3eb657aasc9303db4fed698b6@mail.gmail.com>
On Tue, Jul 22, 2008 at 1:55 PM, Keryx Web <webmaster at keryx.se> wrote:
>> On Mon, Jul 21, 2008 at 10:31 PM, Robert (Jamie) Munro wrote:
>>>
>>> What's wrong with:
>>>
>>> <label for="myfield">Instructions</label>
>>> <input id="myfield" etc />
>>> <label for="myfield" class="error"> Must be a valid  value</label>
>>>
>>> Can an input not have 2 labels?
>>
>
> Thomas Broyer skrev:
>
>> Or even:
>> <label>Instructions <input etc> <strong class=error>Must be a valid
>> value</strong></label>
>
> Both of these suggestions lack the precision, the semantics and the
> flexibility of my suggestion.

Of course, I wasn't intending to dismiss your proposal with such code fragment.

I think however that if the user wants to let the UA handle validation
events, it should accept that the UA manage the UI; and I expect them
to overlay error messages (or use any other unintrusive mean).

> Vz Thomas B's solution:
> - What if a designer wishes to have the error messages grouped together on
> the top of the page, instead of next to the input fields and manages to come
> up with a solution that is very usable?

They handle invalid events in script. You can expect
libraries/frameworks to quickly add facilities for that as soon as
HTML5/WebForms2 start to be used and usable, such as:

$("#my_form").on("invalid").showErrors("#my_forms_errors", {
   kind: "bulletlist",
   prefix: "Please correct the following error(s) and then retry:" });

> - For the default UA error messages to be inserted correctly it must honour
> the classname as a microformat. Since that must be spec'd, it might just as
> well be a real element.

Or the default UA error messages could just be displayed the way the
UA chooses to display them (using baloon tooltips attached to each
invalid field, or using a thick red outline and only display the error
message in a tooltip on mouseover, etc.)


-- 
Thomas Broyer
Received on Tuesday, 22 July 2008 07:13:41 UTC

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