On Wed, 12 Apr 2006, Mike Kienenberger wrote:
> > You should be able to make the OptionalValidationFramework work for
> > this situation, but there are probably better ways to do it.

On 4/12/06, Joerg Bredlau <[EMAIL PROTECTED]> wrote:
> I've tried out the example on your Wiki-Page:
> http://wiki.apache.org/myfaces/OptionalValidationFramework
>
> Here is my Code:

>    <jsfcomp:optionalValidator
>       <f:param name="NET_SF_JSFC_OPT_VDTR_MODE" value="soft"/>
> <jsfcomp:optionalValidatorWrappingRequiredValidatorChecker/>
> Can you give me an working example?


You want to dump all of the optionalValidator-prefixed stuff.   It's
not necessary for the problem you're trying to solve, and it only
works if you're using facelets or JSF 1.2.   Even then, it hasn't been
well tested up to this point.

If all you want is the required validator, do something like this:

<h:form>
      <jsfcomp:submittedValueCollectorWalker/>

      <uiinput>
          <jsfcomp:requiredValidator/>
      <uiinput/>

      <uiinput>
          <jsfcomp:requiredValidator/>
      <uiinput/>

      <jsfcomp:requiredValidatorChecker/>
</h:form>

This requiredValidator code has been far better tested, and is far
simpler than the optional validation stuff.   However, you'll want to
add an attribute to requiredValidator to support a "message"
parameter.   You can copy the ValidatorBase and ValidatorBaseTag
classes from MyFaces Tomahawk -- that's what these classes currently
add.   I'll give you commit access to jsf-comp if you're interested in
doing this.

Again, I think your time would be better spent figuring out how to add
the requiredMessage attribute to the Tomahawk component base, though.

Reply via email to