[whatwg] Default values for step
Ian Hickson
ian at hixie.ch
Fri Jun 25 08:45:43 PDT 2004
On Fri, 25 Jun 2004, Will Levine wrote:
>
> <input name="foo" type="number">
> This little snip of code is used for, very not surprisingly, inputting
> a number. This make sense. However, what I find misleading is that
> this code cannot be used for inputing any number, but can only be used
> for inputing integers (because the default step is 1).
Yeah, I agree this is suboptimal.
> I would guess that more forms on the web would require integers than
> not, but many will need fractional values and it doesn't seem to make
> sense to constrain the type (by default) based on this.
Well, the idea is to make the most frequent cases the easiest to do.
Since most cases will want integers, the default is integers.
As you point out, authors can easily change the step to any:
<input name="foo" type="number" step="any">
...or, more likely, to 2dp:
<input name="foo" type="number" step="0.01">
> Also, I have some questions about the default step on the datetime and
> time types. Admittedly, I can't think of any real cases where one would
> need to specify time precise to the second or fraction of a second in a
> Web app as one could with step=any ([...] It seems to me that in most
> cases, the increment would be 5, 15, 30, or 60 minutes, and not 1
> minute.
We could make the default one of those, I guess. Most of the programs with
dates that I've used do allow one-minute increment, though, even if they
offer five minute increments by default.
> Because there are a number of increments that would be commonly used, it
> would make sense to me to just have the default step as any and authors
> could set it as needed.
Well, "any" seems like the value that is least likely to be useful. Again,
the default is being chosen in such a way as to be the most useful
default, so that for the most common cases, the author doesn't need to set
it. I think authors would be surprised if the default time control allowed
precision to the millionth of a second!
--
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