Data table requires its children to be columns or facets.
<h:dataTable .. value="#{outerBB.itemBB}" var="item"
rendered="#{outerBB.hasItems}">>
<t:column>
<h:inputText id="value1" value="#{item.value1}"
...
On 8/1/06, David Van Stone <[EMAIL PROTECTED]> wrote:
I have a row in a data table which has a few input fields which I want to
validate together. I know the technique of binding the items then using a
hidden input field that is linked to a validator method. As so:
<h:dataTable .. value="#{outerBB.itemBB}" var="item"
rendered="#{outerBB.hasItems}">>
<h:inputText id="value1" value="#{item.value1}"
binding="#{item.value1Input}">
<h:inputText id="value2" value="#{item.value2}"
binding="#{item.value2Input}">
<h:inputHidden id="datacheck" validator="#{item.validateFields}"
value="dummy"/>
</h:dataTable>
(There is just logging so far in the validateFields() method.)
However, I don't get very far when the page appears for the first time (with
no rows in the table):
javax.faces.el.PropertyNotFoundException: Base is null: item
at
org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:460)
at
org.apache.myfaces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:248)
at
org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:449)
at
javax.faces.webapp.UIComponentTag.createComponentInstance(UIComponentTag.java:709)
at
javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:596)
...
If I remove the 'binding="#..."' code, the application calls validateFields
fine.
* Can one set up bindings to elements in a dataTable?
I think I'm missing something, since the data table shouldn't be rendered
and has no items to render. What is it trying to bind at that point?
Thanks for any help,
-David-
--
View this message in context:
http://www.nabble.com/Validating-Multiple-Components-in-DataTable-tf2034458.html#a5597324
Sent from the MyFaces - Users forum at Nabble.com.