PDA

View Full Version : NumberField problem



zdarsky
24 Jul 2009, 12:28 AM
Is there a way how to set a mask for a numberfiled?

for example if I need a number fields holding percents, I'd like to see 1% when a user inputs 1.

I tried:
percentField = new NumberField();

percentField.setMinValue(0);
percentField.setMaxValue(100);
percentField.setFormat(NumberFormat.getPercentFormat());

beu without effect...

fother
24 Jul 2009, 6:42 AM
dont use formmat

try


setBaseChars("0123456789%")

this will allow the user type the char "%"

or

you can add a listener when the field loose the focus (blur), set the value (get value more "%")