[whatwg] [WebForms2] custom form validation notifications

On Wed, 4 Oct 2006, Joao Eiras wrote:
> 
> Although WebForm2 provides automatic validation of form content from the 
> UA side, the specification has a few gaps related to customizablility of 
> notifications, by web authors, without scripting enabled.
> 
> If the user fills a form in an improper way the UA should alert him of the
> problems. Opera in the early days of its initial web forms support showed an
> alert box stating that the information was invalid, now it flashes the input
> field, and presents a message overlapped in the webpage.
>
> However it presents a very generic error message like "You must set a value!"
> (for required) or "foo is not in the format this page requires" (for pattern).
> The author may want, in the case of an error, to present its custom error
> message to the end user.

You can call setCustomValidity() to set a specific string.


> If the UA has scripting disabled, trying to prevent the default action 
> for an invalid event won't work. Too overcome this problem, there could 
> be a new attribute which could be called 'notifyoninvalid="true|false"' 
> with a default value of true, for each control, or for the entire form. 
> If the value is false, then the UA wouldn't notify the user in case of 
> invalidity. This could then be delegated to some CSS using :invalid;

If scripting is disabled, why would you not want the user notified? That 
would be pretty bad UI. :-)


> Now, to ease the authors work, there could be another css pseudo-classes, to
> compliment :invalid, which is :valid
> *:valid{border:thin solid green;}

This already exists:

   http://www.w3.org/TR/css3-ui/#pseudo-validity


Regarding custom messages for pattern="" (the case where making a good 
message is hard), the spec suggests using title="" for the message.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 23 October 2008 08:40:06 UTC