• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

question about validating multiple fields

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic