You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Si...@equifax.com on 2007/03/01 17:34:35 UTC

use of jsf client validator inside a datatable

Hi,

I am using the jsf client validator components for client side validation 
in my jsp's.  I have some queries on how the client validator components 
could be used to validate jsf input components inside a datatable.

I have a datatable in which each column is a inputText component, Now I 
can't use the client validator components to validate the entered value 
because to use the cv components I need to specify the id of the component 
I need to validate. In the case of input components contained inside a 
datatable since the id is generated at runtime it  is different for each 
row.

To illustrate my problem, consider the below snippet :
....
<t:datatable ....>
        <t:column width="10%">
                <f:facet name="header">
                        <h:outputText value="Wanted"/>
                </f:facet>
                <h:inputText id="wanted" size="5" value
="#{record.matrixRecord.recordsWanted}"  styleClass="input"/>
                <cv:requiredFieldValidator componentToValidate="wanted" 
highlight="true" display="dynamic" errorMessage="Value is required"/>
        </t:column>
</t:datatable>


I cant use cv as illustrated above since the id of the textbox generted 
for the each row will be ..:0:wanted, ..:1:wanted, ..:2:wanted etc.


Any pointers on how I could use cv for components inside a datatable would 
be highly appreciated.

Regards,
Siju