2 Replies Latest reply on Feb 5, 2013 11:40 PM by Suresh G

    How to use <h:form> in <rich:tabPanel>

    John Scott Newbie

      I' m developing my first JSF2 + Richfaces application and now i have this problem

      I have the following rich:tabPanel to wich add and remove  dinamically tab

       

       

      <h:form>
          <rich:tabPanel id="tabsPanel" switchType="ajax" activeItem="#{tabsBean.activeTab}" >
               <c:forEach var="tab" items="#{tabsBean.tabs}" styleClass="myRightPanel">
                  <rich:tab  name="#{tab.name}" styleClass="myTab" >
                       <h:form id="#{tab.name}" >
                           <ui:include src="#{tab.pathDaIncludere}" />
                      </h:form>
                   </rich:tab>
             </c:forEach> 
         </rich:tabPanel>
      </h:form>
      

      but to run i must add a <h:form> around each <rich:tab> otherwise the actions in the tabs not work

       

      Is correct insert <h:form> in each tab?

        • 1. Re: How to use <h:form> in <rich:tabPanel>
          iabughosh Master

          Hello Covelli,

          Nested forms is not supported by JSF 2, so warpping your tabPanel with h:form and add h:form to your tab will cause you troubles, here is my suggestion :

           

          <rich:tabPanel switchType="client">

               <rich:tab onheaderclick="doAction();">

                    <h:form>

                         <a4j:jsFunction id="doAction" name="doAction" actionListener="#{yourBean.action}"  ...../>

                         .....

                    </h:form>

               </rich:tab>

          </rich:tabPanel>

           

          regards.

          • 2. Re: How to use <h:form> in <rich:tabPanel>
            Suresh G Newbie

            Hello,

            You have to use <h:form> inside <rich:tab>

            Otherwise button actions won't work

             

            <rich:tabPanel>

                 <rich:tab>

                      <h:form>

                           <a4j:jsFunction id="doAction" name="doAction" actionListener="#{Bean.action}"  ...../>

                           .....

                      </h:form>

                 </rich:tab>

            </rich:tabPanel>