W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2011

[whatwg] Form input element for value-unit pairs

From: Diogo Resende <dresende@thinkdigital.pt>
Date: Tue, 15 Mar 2011 01:20:34 +0100
Message-ID: <3f1c5ac2bd268d5a49cc547443421b41@thinkdigital.pt>

 On Mon, 14 Mar 2011 22:09:26 +0200, Jukka K. Korpela wrote:
> Christoph P?per wrote:
>
>> A new type is probably not necessary, because a new attribute that 
>> is
>> called something like ?unit? and is only valid in the ?number? and
>> ?range? states could be enough.
>>
>>   <input type="number" id="fontsize" value="12" unit="pt">
>
> I don't quite see the point (no pun intended). It seems that the
> unit="pt" attribute just says that the input number will be
> interpreted as a number of points, i.e. a certain unit will be
> implied. This sounds unnecessary, as the form data processing can
> handle such things without any extra attributes.
>
> Or do you mean that the presence of the unit="..." attribute would
> trigger a special implementation of numeric input, so that the user 
> is
> expected to enter both a number and a unit, with the latter defaulted
> according to the unit attribute?

 For me it would be great that a UA would implement an numberic input 
 with
 a visible but unchanged unit. Something like an <input>+<span> but the 
 span
 looking to be inside the input.
  ________
 [__12_pt_]
      ^------ cursor would not pass this point

 Extra:

 This is more interesting for other types of input, not necessarily 
 numeric,
 like IPv4, currencies, HH:MM, ..
Received on Monday, 14 March 2011 17:20:34 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:31 UTC