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

Ian Hickson ian at hixie.ch
Wed Aug 25 18:14:49 PDT 2004


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.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list