On 8/9/06, Joe ersinghaus <[EMAIL PROTECTED]> wrote:
Is it possible to have more than one component validated as a group? For
example:  let's say I've have a radio button that when activated, text
must be entered/validated in that radio button's associated input field?

In other words, only when the radio button is selected, should the input
filed be validated.

It's occurring to me that I need something somewhat similar.  I need
to verify that if a starting date is specified, a second ending date
is also specified.  Up to this point, I've been doing the validation
like this in my action method and binding the components to my backing
bean.

However, it'd really be more convenient to handle this as a real validator.

So let's brainstorm how this would work, and I'll throw together
something from a clone of my compareToValidator.

Maybe something like validateRequiredIf for=<other component>
operator=<an operator> value=<a value binding>

So for my dates, I'd use

 <inputCalendar id="startingDate">
     <validateRequiredIf for="endingDate" operator="ne" value="null">
 </inputCalendar>

 <inputCalendar id="endingDate">
     <validateRequiredIf for="startingDate" operator="ne" value="null">
 </inputCalendar>

I have to put it on both.   If I put it only on endingDate, then if
endingDate was null, the validateRelationship would not be executed.


So how would this work for your situation?  The validator has to be on
a non-null input component.

 <radiobutton id="radioComponent">
     <validateRequiredIf for="associatedInput" operator="ne" value="null">
 </radiobutton>
 <inputText id="associatedInput">
 </inputText>

Seems ackward.   Maybe it needs a better name.   Maybe we could just
drop the operator/value attributes (it'd be true for our two use
cases).

Reply via email to