[whatwg] Errormessages in forms

Oldřich Vetešník vetesnik at mrmil.cz
Wed Nov 5 08:10:58 PST 2008


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



More information about the whatwg mailing list