[whatwg] WebForms2 validity

On Tue, Oct 28, 2008 at 8:09 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Fri, 9 Feb 2007, Sean Hogan wrote:
>>
>> 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?
>
> Continually (in particular whenever the constraints or the values change
> -- the validity states are defined in terms of those values).
>
>
>> 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.
>
> Why?

I agree with Sean's idea: at least on the initial state, controls
showing up with "invalid" styling can be quite confusing to many
users. It may depend a lot on the context, and even more on the user:
although the initial "" for a required text field would be invalid,
and even would make sense to visually convey that fact, many users may
wonder "What did I wrong if I didn't do anything yet?". The best
solution I can think of this would be an additional pseudo-class, such
as ":default", ":initial-value", ":non-modified", or anything like
that (I'm really bad at naming stuff, so please take those only as
*examples*, because that's what they are), which could be used
together depending on the needs of each site or application, like
this:
:valid {
// code for "green" higlighting
}
:invalid {
// code for "red" highlighting
}
:default {
// overriding code to remove highlighting (or to apply "white" highlighting)
}
:default:invalid {
// code for "yellow" highlighting
}
That's just an example. The idea is that an application may need to
convey (through styling the validity pseudo-classes) the meanings "you
have put something wrong here" and "you have to provide something
here" as different concepts.

Just my thoughts.

Received on Tuesday, 28 October 2008 13:27:47 UTC