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 00:30:10 +0000 (UTC)
Message-ID: <Pine.LNX.4.61.0408260013420.21417@dhalsim.dreamhost.com>
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:

   http://www.w3.org/TR/DOM-Level-2-Traversal-Range/traversal.html#Traversal-NodeIterator


> 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

Added.


> 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>+ ]? ]?

etc.

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.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 25 August 2004 17:30:10 UTC

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