Hello i am using primefaces version 3.2 The ui layout which i am using is tabview, inside it, i’ve accordion panel, and inside every tab of the accordion, i’ve two forms.
Just like
tabview>tab>accordionpanel>tab>form1 and
tabview>tab>accordionpanel>tab>form2 and so on…
Now, the problem is that the active index action is not called in the above scenario. However, when i remove on of the froms from the accordion panel tab, it is called and works fine.
This is my xhtml tabview code
<p:tabView id="tabView" activeIndex="#{profileInfoManagedBean.myCurrentTab}" >
<p:ajax event="tabChange" listener="#{profileInfoManagedBean.tabIsChanged}" />
<p:tab id="locationInfoTab" title="Location Info">
<p:accordionPanel id="aPanel">
<p:tab id="tab1" title="Country">
<h:form id="form1">
<p:growl id="growl" life="5000" />
<p:messages id="messages" />
<h:panelGrid columns="3" cellpadding="5" cellspacing="5">
<p:column>
<h:outputLabel for="country" value="Country: "></h:outputLabel>
</p:column>
<p:column>
<p:inputText id="country" value="#{profileInfoManagedBean.country.country}" required="true" label="City">
<f:validateLength minimum="5" maximum="20" />
<p:ajax event="blur" update="msg1"></p:ajax>
</p:inputText>
</p:column>
<p:column>
<p:message id="msg1" for="country" display="icon"></p:message>
</p:column>
</h:panelGrid>
<p:commandButton type="submit" action="#{profileInfoManagedBean.addCountry}" value="Save" ajax="true" ></p:commandButton>
</h:form>
Are you wanting active index on the locationInfoTab or on the accordion tab1?
I tested and modified your code a little to get the active index on both:
I added tab change event to the accordion panel, update the tabViewForm when tabs change, updated messages when the input changes, and added another tab for testing.
I think the original problem is because of the validator on the input field causing error, but the view was not being updated to show you the message.
By updating the form on a tab change, the validator error message is clear.
I hope this helps you.