1 Reply Latest reply on Feb 12, 2013 4:10 AM by sivaprasad9394

    Using form inside rich:tab with switch type client or server

    robinho

      Hey 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.

        • 1. Re: Using form inside rich:tab with switch type client or server
          sivaprasad9394

          Hi Robinho,

           

          try like below...

           

          <a4j:jsFunction  name="generalInfoLoad" limitToList="true" immediate="true"

                 reRender="generalInformationPage"  ignoreDupResponses="true"
                 actionListener="#{existingCustomerBean.submitgeneralInfoTabLoad}"></a4j:jsFunction>

           

          <rich:tabPanel switchType="ajax" id="tp1" styleClass="tabbertab">            
          <rich:tab limitToList="true" id="GeneralInfo" label="General Info" name="General Info" styleClass="myClass"  ontabenter="generalInfoLoad()"
             status="waitStatusGeneral" reRender="generalInformationPage">
          <a4j:region id="generalInforegion">
          <a4j:include id="generalInformationPage"  viewId="/generalinfo/generalInformation.jsp"/>
          </a4j:region>
          </rich:tab>
          </rich:tabPanel>

           

           

          Here add form for the general information page.because as you said nested forms not allowed.

           

          Thanks,

          Siva