webtier@glassfish.java.net

Re: [webtier] Custom validator, empty inputTextarea

From: <webtier_at_javadesktop.org>
Date: Sat, 23 Aug 2008 04:48:59 PDT

I think Roger is talking about validation methods that you put inside a backing bean, like shown here:
http://www.ibm.com/developerworks/library/j-jsf3/#N105E7

If you want to go berserk, you could also create a custom validator that conditionally checks required fields.

That way, you'll get something like this:
<h:input... id="theCheckBox" />
<h:input...>
  <foo:validateRequiredIfChecked for="#{theCheckBox}" />
</h:input>

Or to make it more reusable:
<h:input... value="#{myBackingBean.someBoolean}" />
<h:input...>
  <foo:validateRequired if="#{myBackingBean.someBoolean}" />
</h:input>
[Message sent by forum member 'jkva' (jkva)]

http://forums.java.net/jive/thread.jspa?messageID=294959