W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2010

[whatwg] Submit controls should be barred from constraint validation in favor of a new pseudo-class

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 31 Dec 2010 01:20:35 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1012310114340.28593@ps20323.dreamhostps.com>
On Thu, 23 Sep 2010, Mounir Lamouri wrote:
> It sounds like currently the specifications want explicitly to have all 
> submit controls being subject for constraint validation [1] which seems 
> to be a weird idea. Given that only setCustomValidity() can be used on 
> those controls, the only use case I see is to set the submit controls 
> invalid when the form is invalid thus having :invalid style applying to 
> them.
> If the given use case is correct, I think we should make all submit 
> controls barred from constraint validation and introduce a new 
> pseudo-class allowing to style submit controls when their form is 
> invalid.

Form controls are part of constraint validation for completeness only, as 
far as I can tell. Anything that's visible and submitted is a candidate 
for constraint validation.

> This would prevent having invalid elements styled exactly like the 
> submit controls (which would let the user think the submit control is 
> invalid) and it would prevent having :valid applying on buttons for no 
> apparent reason.

I don't imagine people would style :valid without specifying the specific 
element. I mean, you wouldn't want the same style to apply to your radio 
buttons and your text fields and you <select> elements either.

> This pseudo-class would apply on all submit control inside a form which
> has at least one invalid element subject for constraint validation.

If people want to style submit controls based on the states of other 
elements in the form, then we could certainly create a new pseudo for 
that. Do people do that enough to justify it?

> Current Gecko nightlies (and next beta, beta7) have a 
> :-moz-submit-invalid pseudo-class. Submit controls can still be marked 
> invalid but that might change before the final release if there is an 
> agreement that :-moz-submit-invalid is a better way to fulfill the need.
> As a side note for web authors on this list, :-moz-submit-invalid 
> currently has a default style on Firefox but that is very likely going 
> to change for beta8.

Do people use this feature much?

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 30 December 2010 17:20:35 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:02 UTC