• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Dan Acuff
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i understand your problem right, you can do this.

 
Tim Holloway
Saloon Keeper
Pie
Posts: 18100
51
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic