View Full Version : NumberFormat not formatting single digit currency amounts

25 Apr 2011, 12:50 PM

I'm working on an enterprise GWT/GXT application and we've recently
noticed that our currency fields are not correctly formatting single-
digit inputs.

We're using java.math.BigDecimal to represent the internal values, and
using NumberFormat.getFormat("$#,##0.00; ($#,##0.00)") for our format

What happens is when the user enters a value in a field (which has a
correctly-formatted default value of $0.00) and hits tab to exit the
field, the format only applies to entries that are 10 or larger. If
they enter a single-digit value, it won't be formatted. They can work
around this by first entering a number 10 or larger, tabbing out, then
going back and changing it to a single digit value, and tabbing out
again, at which point the formatting correctly applies.

To further complicate matters, this only occurs on the actual server;
the formatter works perfectly fine in local hosted mode. This occurs
in both IE8 and Firefox 3.

We're running GWT 2.1.1.

Thanks for your time!