[whatwg] Errormessages in forms

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