[whatwg] Form element invalid message
Simetrical+w3c at gmail.com
Wed Sep 22 14:51:25 PDT 2010
On Tue, Sep 21, 2010 at 4:35 PM, Shiv Kumar <skumar at exposureroom.com> wrote:
> Come now Aryeh :). Imagine this scenario. On a web page/form, I'm asking the user to enter her social security number and she sees a message "You have to specify a value", you're saying that sounds ok to you? Oh, and the next browser will say something like, "This is a required field". What then?
A Firefox 4 nightly (which apparently does have UI for this) moves
focus to the problem field and says "This field is mandatory, you have
to fill it." Opera focuses the field, flashes it red, and says "You
have to specify a value". I find it hard to see how either of these
> I guess what I'm saying is there should be ways to hook into all of this. That will give people the option to do their own thing but using the plumbing that's in place. I'm really not asking the browser UI implementation. I think we should have a scriptable/event driven way to hook into all this. There are a bunch of toolkits that do this and allow one to hook into the process, making it customizable. If it's not customizable, it's not useful for the majority.
It is customizable.
> I wasn't aware of this, I apologize. Where can I find this. I spent a lot of time going through the docs before I posted. Note that checkValidity() and setCustomValidity(message) are not the solution for this.
data:text/html,<!doctype html><form><input name=x required
oninvalid="this.setCustomValidity(''); if (!this.validity.valid)
this.setCustomValidity('abcd')"> <input type=submit></form>
In a Firefox 4 nightly, when I click the submit button, the error is
just the string "abcd". In Opera it's worse -- "The value is not
allowed by a script on the page! abcd" (visible double space after
"value", due to inserting the string unquoted) -- but the Opera UI
here is really bad in many ways, as noted, and is likely to improve as
other browsers implement good UIs. Note that Firefox is buggy here
and treats setCustomValidity('') as setting the error message to ''
instead of removing it, as the spec says, but when that's fixed it
But I don't think most authors will need to do this for common errors.
On Wed, Sep 22, 2010 at 5:32 PM, Mounir Lamouri
<mounir.lamouri at gmail.com> wrote:
> Firefox nightlies too. Will be in Firefox 4 beta 7.
Is there a place where the design rationale is given, and where design
suggestions could be made? I think the UI here could use improvement.
This usability study is particularly interesting:
The Firefox build I have (might be a couple days old) seems to a)
highlight incorrect answers before the user changes them, and b) only
report error messages onsubmit, rather than onblur as the study
More information about the whatwg