[whatwg] [WF2] type=number and leading zeros

On 20 Mar 2006 at 23:25, Ian Hickson wrote:

> > Spec doesn't disallow submitting leading zeros for input type=number 
> > values but I know a developer who apparently thinks it should.
> > 
> > Is it against the "idea" of input type="number" to send leading zeros if 
> > the users type them?
> 
> The format the user uses to type the number (if he types it at all, as 
> opposed to using a spinwheel, e.g.) is independent of the submission 
> format. type="number" is a number, not a string; there is no semantic 
> difference between 00000.0001 and 1e-4, and so the spec allows the UA to 
> send any of those as it deems appropriate.
<X>
> If the field is for a postcode or credit card number, then type=number is 
> an inappropriate field type. Those aren't numbers, they're specially 
> formatted strings.

Thanks for clarifying. Could the spec give clearer advice to authors 
on this point? We've come across this problem in the wild (it is 
perhaps more likely to be part of a custom form validation than an 
attempt at following WF2 but I can see authors getting a bit too 
excited about the new types and label anything that looks like a 
number with type=number.)

Currently spec says:

The submission format is not intended to be the format seen and used 
by users. UAs may use whatever format and UI is appropriate for user 
interaction; the description above is simply the submission format.

Suggested addition:

Since the value that is submitted may differ from what the user sees 
or types this type is not suitable for inputting for example credit 
card numbers or postal codes. Authors should use text inputs instead 
if submitting the exact string as typed by the user is important.


-- 
Hallvord Reiar Michaelsen Steen
hallvord at hallvord.com  http://www.hallvord.com/

Assuming that communication is possible is more fun

Received on Tuesday, 21 March 2006 04:39:34 UTC