aspose file tools*
The moose likes JSF and the fly likes How to prevent values over 99inches but still allow 13.5 inches Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to prevent values over 99inches but still allow 13.5 inches" Watch "How to prevent values over 99inches but still allow 13.5 inches" New topic
Author

How to prevent values over 99inches but still allow 13.5 inches

Dan Acuff
Ranch Hand

Joined: Jul 13, 2009
Posts: 62
I am tasked with preventing someone from entering in 120 into the following three inputText boxes.
But they still have to be able to enter i.e. 13.5 inches.

How would I go about doing this? I do not even know where to start.

Roma Datta
Greenhorn

Joined: Jun 26, 2010
Posts: 3
if i understand your problem right, you can do this.



SCJP
Open Source is the world!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16058
    
  21

I'm not quite sure what you're asking here. If you prevent values over 99 inches, why is 13.5 inches a special case worth mentioning? Is that you really mean than only values between 0 and 99.9 or so are allowed?

If so, a converter isn't what you need. You need a RangeValidator. Basic JSF stuff.

If you're ambitious, you can also attach JavaScript to the controls to limit things on the client side, but even then I'd recommend putting range validation on your input controls.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to prevent values over 99inches but still allow 13.5 inches