Probably the way to do this is to create a custom validator, and put
it on a component (typically inputHidden) after the data table, and
have your validator iterate through the UIData components.

Here's some threads that have covered this issue to one degree or
another in the past:

http://mail-archives.apache.org/mod_mbox/myfaces-users/200608.mbox/[EMAIL 
PROTECTED]

http://mail-archives.apache.org/mod_mbox/myfaces-users/200609.mbox/[EMAIL 
PROTECTED]

http://markmail.org/message/beievnlwiet6lpqh


On 3/14/08, Dario <[EMAIL PROTECTED]> wrote:
> Hi all,
>  I'm quite new to this discussion list, and I found it very interesting.
>  I'm sorry if the problem has been already discussed.
>
>  I have a dataTable with a checkbox on each row (an extract is below).
>  I'd like to create a custom validator that verifies that at least a
>  checkbox in the list has been selected.
>  However, I cannot apply it directly on the h:selectBooleanCheckbox
>  component, since it a "relationship validator". It seems it cannot be
>  applied to t:dataTable, since it isn't an UIInput component (I'm not
>  really sure about this).
>  I can perform the check directly in the action and generate a
>  FacesMessage object, but this means that the check is after the Update
>  Model Values phase, where I prefer it would be in the Process
>  Validations phase.
>
>  Is there a correct way to approach this problem?
>  I'm using JSF 1.1.
>
>  Regards,
>  Dario
>
>  <t:dataTable value="#{lab.datas}" var="varData">
>                 <h:column id="sel">
>                     <h:selectBooleanCheckbox id="checked1"
>                         value="#{varData.checked}" />
>                 </h:column>
>
>                 <h:column id="person">
>                     <h:outputLabel
>                         value="#{varData.person}" for="checked1"/>
>                 </h:column>
>  </t:dataTable>
>  <h:commandButton type="submit" value="#{someAction}" />
>
>

Reply via email to