See org.apache.wicket.validation.validator.NumberValidator.MinimumValidator
for example.
In your custom validator's onValidate() you need to check
that validatable.getValue() is an instance of Number.

On Wed, Feb 23, 2011 at 10:34 AM, Nivedan Nadaraj <shravann...@gmail.com>wrote:

> Hi All,
>
> Basic question but have not got an answer to it. I want to validate a field
> to accept only numbers and provide a validation message.
> Is there a NumericValidator I checked NumberValidator but don't see how I
> can use it..it says its deprecated.
>
> TextField<Long> yearOfExpiry = new TextField<Long>("yearExpired");
>
> I guess the validator should check if it is of the right type(data type)
> ..i.e Numeric..
>
> Or should I build a CustomValidator? If I have to would there be an example
> of how this can be built? Look at the Wicket Code base?
> Thanks guys
> Niv
>

Reply via email to