0

I have a tabView that will contains a certain number of tabs depending on the list i pass to the tabView. Inside each tab, i have a dataTable which values can be changed thanks to inputText inside the columns.

Here is the corresponding code:

<h:form id="otForm">
<p:commandButton update="@form" styleClass="button" icon="fa fa-check iconColor" id="btnValid" action="#{otCtrl.preValidateOt}" value="Submit" />
    <p:tabView styleClass="tabViewClass" value="#{otCtrl.modelDtoToDisplay.otFils}" var="otFils">
        <p:tab titleStyleClass="tabClass">  
            <p:dataTable var="propOt" id="propTab" value="#{otFils.listOtPropToModif}" styleClass="tableClass"
                style="width:1120px !important; text-align: left;" paginator="true"
                emptyMessage="#{i18n.getMsg('warning.table.vide')}"
                rows="10"
                paginatorTemplate="Total : #{otFils.listOtPropToModif.size()}  {CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} "
                rowsPerPageTemplate="10,25,50,100,200" paginatorPosition="bottom" rowIndexVar="rowIndex"
                rowStyleClass="{(rowIndex mod 2) eq 0 ? 'highlight1' : 'highlight2'}">
                <f:facet name="header">
                    <h:panelGrid columns="1" style="margin-left: 5px;text-align:left;width: 120px;" columnClasses="columnLeft2">
                        <h:outputText value="Properties" />
                    </h:panelGrid>
                </f:facet>
                <p:column headerText="Property" sortBy="#{propOt.proprieteDTO.prop}" style="width:150px;">
                    <p:outputLabel for="propObli" value="#{propOt.prop}" />
                </p:column>
                <p:column headerText="Value" sortBy="#{propOt.valeur}" style="width:220px;">
                    <p:inputText id="propObli" value="#{propOt.valeur}" required="true"
                        requiredMessage="#{propOt.prop} is required"
                        style="width:98%; />
                </p:column>
            </p:dataTable>
        </p:tab>
    </p:tabView>
</h:form>

This tabView is encapsulated inside a form. The problem that i face is when i press the validation button only the values of the last tab is saved. The other inputText will stay null, even if i put a value before submitting.

Any idea why is this happening ?

I use primefaces 5.3 and jsf 2.2

EDIT : I added the validation button as you requested. see code above.

Marouane Lakhal
  • 774
  • 1
  • 15
  • 42

0 Answers0