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

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