W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2004

[whatwg] Webforms 2 comments - add .validation usage examples and equivalent BNF for new input TYPEs

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 26 Aug 2004 01:14:49 +0000 (UTC)
Message-ID: <Pine.LNX.4.61.0408260030240.21417@dhalsim.dreamhost.com>
On Fri, 13 Aug 2004, Olav Junker [iso-8859-1] Kj?r wrote:
> 
> I'm concerned that authors would write things like:
> 
> if (inputype.validity==form.ERROR_TOO_LONG) { 
> 	// nag
> } else if (inputype.validity==form.ERROR_PATTERN_MISMATCH) {
> 	// nag
> }

True.


> I'm not sure what the solution is, maybe an error-object with boolean 
> fields for each possible error, so you could write:
> 
> if (inputype.validity.isTooLong) { 
> 	// nag
> } else if (inputype.validity.isPatternMismatch) {
> 	// nag
> }
> 
> This seems a bit more scripter-friendly to me.

Good idea.

I've defined it so that |validity| is still the bitfield that it was 
before, but now also supports .isFoo property access.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 25 August 2004 18:14:49 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:36 UTC