Yes, I looked into creating an <or> validator at one point, but it's
not really feasable for JSF 1.1 and even JSF 1.2 would be tricky.
I'd recommend looking at compareToValidator in the sandbox rather than
EqualValidator -- it's a better implementation and it'll soon replace
EqualValidator internally (Probably in 1.1.5 Tomahawk).
Also, we tossed around the idea of creating an validateRequiredIf
validator a month ago. Then those of us working on it got swamped,
and we haven't gotten back to it.
There are a few things to watch out for, so you probably want to
review what we've discussed already.
http://www.mail-archive.com/[email protected]/msg26362.html
You could feel free to summarize and revive the discussion back on MyFaces-dev.
On 9/20/06, Gert Vanthienen <[EMAIL PROTECTED]> wrote:
Martin,
One solution might be to create a custom validator for this. You might
want to take a look at
org.apache.myfaces.custom.equalvalidator.EqualValidator for an example
on how to access another component than the one you defined the
validator for.
Hope this helps,
Gert Vanthienen
[EMAIL PROTECTED]
Martin Denham wrote:
> Has anybody done "either this or that required" validation of a list
> of items.
>
> Here is what I mean - either phone or email are required for each person
>
> <c:forEach items="#{people}" var="person">
> <af:inputText value="#{person.email}" required="ifPhoneNotEntered"/>
> <af:inputText value="#{person.phone}" required="ifEmailNotEntered"/>
> </c:forEach>
>
> I thought about iterating over the list of people in the Invoke
> application phase, but then it would be tricky to attach an error
> message to the appropriate person row.
>
> Thanks
>
> Martin
>