Using form inside rich:tab with switch type client or server
robinho Jan 9, 2013 11:41 AMHey everyone,
I have a very basic page with a tabPanel (switchType=ajax) and a couple of tabs.
These tabs include pages which used to contain forms themselves in Richfaces 3.x.
Now that the tabPanel needs a surrounding form with ajax switchType in Richfaces 4
and nested forms won't work, I was looking for an solution, since switchType client is not an option for me.
I found this.
But I still can't get it to work, even using a global form.
I get the JavaScript error that the parent form could not be found. Here is my code:
tabPanel.xhtml
<h:body>
<h:form id="globalForm">
<rich:tabPanel switchType="ajax" id="tabPanel">
<rich:tab id="tab1">
<f:facet name="header">
<h:outputText value="#{msg.label}" />
</f:facet>
<ui:include
src="tab1.xhtml" />
</rich:tab>
<rich:tab id="tab2">
<f:facet name="header">
<h:outputText value="#{msg.label2}" />
</f:facet>
<ui:include
src="tab2.xhtml" />
</rich:tab>
</rich:tabPanel>
</h:form>
</h:body>
tab1.xhtml
<rich:panel header="#{msg.label}">
<h:form>
<a4j:commandButton id="resetApplication"
value="#{msg.reset}"
oncomplete="#{rich:component('resetConfirmation')}.show()">
</a4j:commandButton>
</h:form>
</rich:panel>
<rich:popupPanel modal="true" id="resetConfirmation">
<h:outputText value="Are you sure?" />
<h:form>
<a4j:commandButton id="confirmReset"
value="#{msg.reset}" type="submit"
action="#{myBean.reset}" />
</h:form>
</rich:popupPanel>
Now in the link above I've read something about using a4j:region but where exactly do I need to use it?
I tried regions where the h:forms used to be and one region for the whole tab1.xhtml, both resulted in same error message.
I also tried switching to switchType server as suggested in the link, but no help.
Anybody got a solution for this?
edit: btw. the popupPanel opens correctly. The error occurs when clicking the commandButton.