[whatwg] WebForms2 validity

Sean Hogan shogun70 at westnet.com.au
Thu Feb 8 14:38:34 PST 2007


I might be missing something obvious, but...

When are ValidityState properties updated? 
And when are CSS pseudo-classes (:valid, :invalid, :in-range, 
:out-of-range) updated? 

The spec doesn't say, so I tentatively assume they are meant to always 
be up-to-date. 

Many textual input form-controls would begin in one or another invalid 
state (valueMissing, patternMismatch) however authors would typically 
want CSS validity styles to apply only after checkValidity() - either a 
manual one or the automatic one performed by form-submission. 

Of course, one could always dynamically tag form-controls with some 
appropriate class (e.g. "validated") and hang your styles off that. 

input[type=text]:invalid.validated { background-color: red; }

Which wouldn't work when scripting is disabled, but should be sufficient. 

Anyway, could you clarify this? 

Ta,
SDH






More information about the whatwg mailing list