[whatwg] Form input element for value-unit pairs

Diogo Resende dresende at thinkdigital.pt
Mon Mar 14 17:20:34 PDT 2011


 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, ..



More information about the whatwg mailing list