PDA

View Full Version : How to Validate only for Numbers



Suma
24 Jun 2009, 8:30 PM
Hi,
I have a TextField in which i want to allow the user to enter only Numbers and Decimal point. Kindly tell me how do this.

jadrake75
25 Jun 2009, 8:48 AM
Two solutions:
(1) Use NumberField which extends TextField and is meant to only allow entry of numbers. There are some nice methods to set the format with this.
(2) Use a validator with the TextField (why if we have a NumberField) - the problem here, is the validator is only called I believe if the field is requird? (not sure on this).

I would go with NumberField.