File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple validators for single input text

 
tom davies
Ranch Hand
Posts: 168
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form with a number of input values. i want to be able to perform multiple validations on each input text. Currently all fields must have a value in, this works fine and a message is displayed if no value is found. I also want to apply a number of other validations such as validate length. i have tried using the code below but the form still submits.

 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WHERE did you get these validators

And why would you want a "required" validator when "required" is built into the parent tag to begin with?

If JSF doesn't understand an element, it ignores it, so unless you have real validators attached to those tags, they won't do anything.
 
tom davies
Ranch Hand
Posts: 168
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The validators i found form here.
http://www.jsftoolbox.com/documentation/help/12-TagReference/core/f_validator.html
Are these not correct?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. That "validateRequired" threw me. It seems redundant. And, in fact, the Oracle docs indicate that all it does is do the same thing as 'required='true"'. It also might be new to JSF2, since I haven't seen it before.

Speaking of JSF2, I noticed that the underlying Java class (EditableValueHolder) has 2 different validator properties, one for a single validator and one for a collection of validators. No indication of what release the multiple-validator property was added at, though. If you're using a JSF v1 implementation, that might explain things.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic