1 Reply Latest reply on Mar 28, 2008 4:01 PM by Jeff Jo

    <rich:togglePanel> says parent panel can't be found

    Jeff Jo Newbie

      I am using MyFaces 1.1.5 and Richfaces 3.1.4 GA and I can't get <rich:togglePanel/> to work. I am getting the following error:

      javax.faces.FacesException: Parent panel for control (id=body:add_edit_form:_idJsp25) has not been found.
      


      Here is my code:
      <h:form id="add_edit_form">
      
       <h:panelGrid columns="1">
       <rich:toggleControl switchToState="dateLocation" value="JJ" for="body:add_edit_form:panel22"/>
       </h:panelGrid>
      
      
       <rich:togglePanel id="panel22" initialState="dateLocation" switchType="client"
       stateOrder="dateLocation,A,B, C, D">
       <f:facet name="dateLocation">
      
      
       </f:facet>
       <f:facet name="A">
      
      
       </f:facet>
       <f:facet name="B">
      
      
       </f:facet>
       <f:facet name="C">
      
       </f:facet>
       <f:facet name="D">
      
       </f:facet>
       </rich:togglePanel>
      
      
      
       <h:panelGrid columns="1">
       <h:commandButton value="Submit"/>
       </h:panelGrid>
      
      </h:form>
      


      Anyone have any ideas?

        • 1. Re: <rich:togglePanel> says parent panel can't be found
          Jeff Jo Newbie

          Figured it out. I'm using MyFaces 1.1.5 and the toggleControl cannot come before the togglePanel on the page. The workaround is this:

          1) Create the toggleControl AFTER the togglePanel and set style="visibility:hidden"

          2) Create the navigation controls (links, images, etc.) using normal JSF tags and set their onclick to:

          TogglePanelManager.toggleOnClient('body:add_edit_form:panel22','dateLocation');
          

          The first parameter to toggleOnClient is the name of the toggle panel and the second parameter is the name of the facet.

          This DOES NOT work if you fail to include the regular toggleControls because TogglePanelManager never gets created. Hope this helps someone.