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 question about validating multiple fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "question about validating multiple fields" Watch "question about validating multiple fields" New topic
Author

question about validating multiple fields

Khopkar Amarish
Greenhorn

Joined: Dec 29, 2005
Posts: 11
Does anybody know how you write a validator that validates a field based on another field? What I have is a radio button and a text field. The radio button has 3 options let's say A, B and C. Only if the item B is selected, then I want to validate the text field based on some regular expression criteria.

Is there a way for me to write a Custom Validator to do this 'conditional' validation, or do I need to just do manual validation of the form?

Amarish
Sergey Smirnov
Ranch Hand

Joined: May 29, 2003
Posts: 167
Currently, there is no form level validation in JSF, but only the component base level validation. The common practice is processing the validation on the Invoke Application (#5) phase. I.e. in the action method. I guess, it is a case that you call "manual validation of the form".

--
Sergey : http://jsfTutorials.net
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
If this problem is specific to one page use manual validation in bean. If this is something common to your framework you can create one custom validator for yourself but it "can" be a bit messy.


- Varun
 
Don't get me started about those stupid light bulbs.
 
subject: question about validating multiple fields