[whatwg] validationMessage

Aryeh Gregor Simetrical+w3c at gmail.com
Thu Feb 11 19:29:00 PST 2010

On Thu, Feb 11, 2010 at 9:39 PM, Ian Hickson <ian at hixie.ch> wrote:
> 2. Getting validation of forms with the UI designed by the author, but
>   with the actual validation work (including working out what the
>   messages should be) done by the UA.
> . . .
> For #2, the author can use validationMessage to get the relevant message,
> which it can then insert into its page dynamically.

I don't think anyone is going to want to do the UI himself but leave
the messages up to the browser -- i.e., I don't think your #2 is a
realistic use-case.  I'd expect browsers to implement widely varying
styles of error messages, so just using the browser's error messages
would create exactly the type of glaring inconsistency that the author
wants to avoid if he's doing his own UI.  E.g., "You cannot submit the
form until you fill in this field." vs. "Please fill in this field."
vs. "Missing field".  Not to mention possibly in a different language
from the page content!

Do you know of any actual authors who would want to use
validationMessage?  If there are any authors here who would want to
use the validation API with their own UI, would you want to use
validationMessage or write your own messages?  I wouldn't be likely to
write my own UI at all, so I'm not the best person to have an opinion

On Thu, Feb 11, 2010 at 9:39 PM, Ian Hickson <ian at hixie.ch> wrote:
> It should show the same message it would give the user if the user hit
> "enter" to submit the form in this scenario.

I suggested UAs might snap the value to the max/min onchange or
onsubmit, so in this case there would be no error: if the user hit
enter, the value would be snapped to the range before submission.  I
guess then the value DOM attribute should reflect what would actually
be submitted, though, and always be valid.

More generally, however, who says the UA will provide actual text for
all validation errors?  I'm not sure what a concrete example would be,
not being particularly good at UI, but I could imagine UAs using some
non-textual cue if you try to submit a form with a missing required
input, say.  They could provide some artificial string in that case,
though, I guess.

More information about the whatwg mailing list