File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Amout validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "Amout validation " Watch "Amout validation " New topic
Author

Amout validation

Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
hi,
how do i validate amount field not to accept characters ?
Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
Originally posted by Mary Cole:
hi,
how do i validate amount field not to accept characters ?


you can create a validator , or look for one around that validates for numbers
Cindy Smith
Greenhorn

Joined: Nov 26, 2007
Posts: 18
You don't have to do anything extra. If the field on the form is bound to a numeric data type on the backing bean, the validation is done for you. If you type a character in the field you will get a conversion error message. Something like this: Specified value is not a valid number.
Hope this helps.
vaitheeswaran subramanian
Greenhorn

Joined: Jan 06, 2005
Posts: 15
Additional you may additional add a validate constraint. In IBM jsf, this is what I do.

<hx:validateConstraint regex="^-?\d+(\.\d{2})?$" />
 
GeeCON Prague 2014
 
subject: Amout validation