myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gert Vanthienen <gert.vanthie...@skynet.be>
Subject Re: either/or required validation of list of items
Date Wed, 20 Sep 2006 13:44:45 GMT
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
gert@anova.be

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
>

Mime
View raw message