Forum OpenACS Q&A: Re: Re: ad_form and currency widget

Collapse
Posted by Mark Aufflick on
And a couple of years later...

I always had a problem with this where 0 values would end up with 00 in the cents box and a decimal point in the dollar box, because the output of this postgres to_char format is:

.00

which confuses a regexp somewhere.

All you need to do is tweak the format:

to_char(price, 'L 999999999990 . 99') as price

Note the last value is a 0 - that means that char should be 0 padded (ie. use a 0 instead of blank) which 9 defaults to only after the decimal place.