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

Ian Hickson ian at hixie.ch
Wed Aug 25 17:30:10 PDT 2004

On Fri, 13 Aug 2004, Brian Wilson wrote:
> When playing around with the .validation constants, I was having a hard 
> time understanding how it worked. Yes, I read it a few times, and then 
> had to have Ian spell it out yet again for me. 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.

NodeFilter.whatToShow is a bit field:


> I'd like to see at least one example of how this works (especially for 
> combination validity errors), such as:
> <input type="text" pattern="[0-9]{10}" name="inputype" value="93284"
> maxlength="4">
> would trigger ERROR_TOO_LONG (16) and ERROR_PATTERN_MISMATCH (32), which would
> yield, when querying the .validity property for that form field a value of 48


> When reading through the section on the new INPUT types, and trying to 
> follow the prose descriptions of what characters are allowed/not 
> allowed, I found myself wishing for a terse BNF string to reference. 
> Perhaps prose-alone was chosen for a reason, but implementers - as well 
> as some of us spec monkeys - have gotten used to BNF notation for a 
> no-nonsense way of making sense of validity domains. Perhaps this can be 
> added to the prose descriptions?

I've added this to the wishlist. I'm reluctant to do it right now since it 
would be quite a lot of work and might introduce contradictions.

In general the allowed values are pretty obvious when you think about it.

Would BNF-like syntax realy be that much better?

   <number> ::= '-'? <integer> [ '.' <integer> ]? [ 'e' '-'? <integer> ]?
   <integer> ::= [ '0' .. '9']+

   <time> ::= <digit> <digit> ':' <digit> <digit>
              [ ':' <digit> <digit> [ '.' <digit>+ ]? ]?


For the big ones (datetime, e.g.), it gets kinda confusing.

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