In a Wicket app, I have a decimal number text field:
TextField<BigDecimal> f =
new TextField<BigDecimal>("f", new PropertyModel<BigDecimal>(model, "share"));
I want it to always accept both . (dot) and , (comma) as decimal separator (regardless of browser's locale settings).
For showing the value, session's locale is used [which in our case is forced to be "fi" (-> comma)], but here I'm interested in what the field accepts as input.
My question is, do I have to change the field to TextField<String>
, and convert to domain object's type (BigDecimal) manually? Or is there some way to use TextField<BigDecimal>
(which allows e.g. making use of Wicket's MinimumValidator or RangeValidator), and still have it accept both decimal separators?