[whatwg] Errormessages in forms

Dne Wed, 05 Nov 2008 16:32:41 +0100 Ian Hickson <ian at hixie.ch> napsal/-a:

> What's wrong with?:
>
>    <label>
>      Instructions
>      <input name="idfield" ...>
>      <strong class="error"> Must be a valid value </strong>
>    </label>

Hello, let me just react on this,
first of all I don't mind using this solution, I want to share an opinion  
though:

This solution doesn't work in IE6, you'd have to add the "for" attribute:

<label for="idfield">
   Instructions
   <input name="idfield" id="idfield">
   <strong class="error"> Must be a valid value </strong>
</label>

which is totally O.K. but just from a point of view, input is not a label,  
nor the error message is. I may need to wrap the text into another element  
for floating purposes though:

<label for="idfield">
   <span class="label">Instructions</span>
   <input name="idfield" id="idfield">
   <strong class="error"> Must be a valid value </strong>
</label>

and here you can see the redundant coding, I'm using another element to  
mark the true label.
It would be awesome if something like this would be possible:

<label for="idfield">Instructions</label>
<input name="idfield" id="idfield">
<error for="idfield">Must be a valid value</error>

And to further enhance this futuristic view:

<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)

What do you think about it? :)

Received on Wednesday, 5 November 2008 08:10:58 UTC