[whatwg] Maintaining unrounded values in forms

On Thu, 24 Nov 2005, Mark Stacey wrote:
>
> When working with a form, sometimes we need to keep an unrounded value
> for calculations, but display a rounded value on-screen. Is there any
> mechanism envisaged for making this readily available without keeping
> track of variables other than the object displaying the value?
>  
> For instance, referencing an object's .value would yield 7889.897777,
> but if the format has been set to #0.00, on screen would be either
> 7889.89 or 7889.90 depending on the rounding settings.

This being a presentation issue, it is in the realm of CSS.

There has definitely been discussion in the CSS working group about giving 
authors the ability to control the display of numbers, times, and dates. 
Most of the ideas involved the 'content' property, as in:

   output#cashregister { content: sprintf('%.2d', attr(#text)) }

...which would take the contents of the element, and parse them as a 
number, and format them according to the sprintf function's "%.2d" 
specifier. (This is just a sample syntax I just made up and doesn't 
necessarily represent what will end up in the spec, if anything.)

I haven't seen any formal proposals yet, though.

I recommend raising this issue on the www-style at w3.org mailing list.

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 25 November 2005 11:51:35 UTC