my xhtml
page has this format:
<h:form>
<p:dialog widgetVar="presentDiag" modal="true" closable="true" header="Liste" maximizable="false" dynamic="true">
<p:commandButton value="Submit" id="submit" actionListener="bean.add()"/>
</p:dialog>
</h:form>
<h:form>
<p:tabView>
<p:tab title="....">
</p:tab>
<p:tab title="....">
</p:tab>
<p:tab title="....">
</p:tab>
</p:tabView>
</h:form>
when I click on the submit button the selected tab changed to the first tab
If you wanted to update a form and then exclude something from it, the easiest way would be to use PrimeFaces selectors like so :
<h:form id="form">
<p:dialog widgetVar="presentDiag" modal="true" closable="true" header="Liste" maximizable="false" dynamic="true">
<p:commandButton value="Submit" id="submit" actionListener="bean.add()" update="@(form :not(.tab-view))"/>
</p:dialog>
<h:panelGroup styleClass="tab-view" >
<p:tabView>
<p:tab title="....">
</p:tab>
<p:tab title="....">
</p:tab>
<p:tab title="....">
</p:tab>
</p:tabView>
</h:panelGroup>
</h:form>
you can always reopen a desired tab by using widgetVar
attribute.
<p:tabView widgetVar="myTab"> .... </p:tabView>
.
.
.
<p:commandButton value="Submit" id="submit" actionListener="bean.add()" update="someId" oncomplete="myTab.select(2);"/>
but the best thing to do would be not closing it in the first place.