No Update of inputText fields in nested (Sub-) Tables when r
torsty Jan 6, 2009 12:50 PMHello,
I have a problem with required="true" fields in a form and input fields in a nested (i.e. sub) table.
My form looks like this:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">
<ui:define name="body">
<a4j:outputPanel ajaxRendered="true">
<h:messages styleClass="message" globalOnly="true"/>
</a4j:outputPanel>
<h:form id="myForm">
<rich:panel id="wrapperPanel">
<rich:panel>
<f:facet name="header">
<h:outputText value="#{messages.PersonalData}"/>
</f:facet>
<!--First Name -->
<s:decorate template="/layout/edit.xhtml" rendered="true">
<ui:define name="label">
<h:outputText value="#{messages.PersonalData_firstName}"/>
</ui:define>
<h:inputText value="#{person.firstName}" required="false" size="40"/>
</s:decorate>
<!--LastName -->
<s:decorate template="/layout/edit.xhtml" rendered="true">
<ui:define name="label">
<h:outputText value="#{messages.PersonalData_lastName}"/>
</ui:define>
<h:inputText value="#{person.lastName}" required="true" size="40"/>
</s:decorate>
</rich:panel>
<rich:panel>
<rich:dataTable styleClass="myTable" value="#{person.contacts}"
var="contact" id="contactTable">
<rich:column colspan="2">
<h:outputText value="#{contact.type}"/>
</rich:column>
<rich:subTable styleClass="myTable" value="#{contact.numbers}"
var="number" id="numberTable">
<rich:column>
<f:facet name="header">Type</f:facet>
<h:outputText value="#{number.type}"/>
</rich:column>
<rich:column>
<f:facet name="header">No.</f:facet>
<h:inputText value="#{number.text}"/>
</rich:column>
</rich:subTable>
</rich:dataTable>
</rich:panel>
</rich:panel>
</h:form>
</ui:define>
</ui:composition>
My problem is, when I do enter text in #{number.text} rows of the subTable but not in #{person.lastName} (the required field) the telephone numbers I entered in the subTable get lost (and a message that person.lastName is a required field appears).
I do have the same problem when I am using a dataTable in a ui:repeat loop.
When I make #{contact.type} editable without a subTable (only a single dataTable) the entered data does not get lost. So, there seems to be a problem with input fields in "nested" tables.
Can anyone help?