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: Olav Junker Kjr <olav@olav.dk>
Date: Fri, 13 Aug 2004 18:05:48 +0200
Message-ID: <WorldClient-F200408131805.AA05480002@jirty.dk>
Brian Wilson wrote:
> I'm not sure if there 
> is  already DOM precedent for the binary value additive method of 
> determining  which validation errors have occurred, but for most this 
> will need more  explanation. 

I'm concerned about this too. I'm pretty sure many javascript authors have
never encountered bit fields. (Personally, I had never used the binary
operators in Javascript before using WF2.) It's more widely used in
lower-level languages, where people are used to thinking in binary.

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
}

It's not intuitive to many javascripters why this won't work, especially
since it will work as intended most of the times, just not when both
errors are present. 

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.

Olav Junker Kj?r
Received on Friday, 13 August 2004 09:05:48 UTC

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