[whatwg] [WebForms2] custom form validation notifications without scripting

Joao Eiras joao.eiras at gmail.com
Tue Oct 3 19:02:47 PDT 2006


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.
This could be achieved by declaring new custom attribute for the several  
controls, which could hold the message. The UA could then either pop up  
that message to the user or embed it in the page (like Opera does  
currently).
The attribute could be named like requirederr, patternerr, or use some  
other sort of naming convention to easily associate the constraining  
property with the message attribute.

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;

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 way it's more easy to provide custom notifications, instead of  
default ones, with no scripting.

Goodbye.




More information about the whatwg mailing list