[whatwg] [WF2] type=number and leading zeros
Ian Hickson
ian at hixie.ch
Mon Mar 20 15:25:19 PST 2006
On Mon, 20 Mar 2006, Hallvord R M Steen 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.
> Some pros and cons:
> - server parsers may interpret leading zeroes as octal values
Only if they are buggy. The spec lays out the exact format that is allowed
to be submitted.
> on the other hand
> - if the field is for a post code, CC number, etc. leading zeros might
> be required
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.
--
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