1 Reply Latest reply on May 25, 2011 7:14 AM by mausbull

    RF4 - collapsiblePanel, render problem

    mausbull

      Hi,

       

      I have a problem with rendering components when a collapsiblePanel and a <rich:message /> tag is included in the page. Therefore, I prepared the following small example that's reflecting my problem.

       

      I use a component to select a value and on selection I'm updating another panel (details). This works fine as long as I don't include a collapsiblePanel with switchType="ajax/server" including a <rich:message /> tag. If the collapsiblePanel is closed the details panel is not updated anymore, however if the collapsiblePanel is opened the details panel is rendered just fine.

       

      <h:form>                
          <a4j:region>
              <h:selectOneMenu 
                  id="runMenu" 
                  value="#{simple.selection}">
      
                  <f:selectItems value="#{simple.upperSelection}" var="mySel"
                      itemLabel="#{mySel}" itemValue="#{mySel}">
                  </f:selectItems>
      
                  <a4j:ajax render="detailsPanel" execute="@region" />
      
              </h:selectOneMenu>
          </a4j:region>
      
          <rich:collapsiblePanel 
              id="addPanel" 
              header="add Panel"
              switchType="ajax"
              expanded="true"
              >
      
              <a4j:region>
      
                  <h:inputText id="panelField" value="#{simple.panelField}">
                  </h:inputText>
                  <rich:message id="qq" for="panelField"/> <!-- works if this tag is removed -->
      
                  <div style="clear: both" />
      
              </a4j:region>
          </rich:collapsiblePanel>
      
          <a4j:outputPanel id="detailsPanel">
      
              #{simple.selection}
      
          </a4j:outputPanel>
      
      </h:form>
      

       

       

      The culprit is the <rich:message /> tag (which I need in my project for validation). When I skip it from the "panelField" the detailsPanel is always rendered.

       

      Does anybody know a solution for my problem?

       

      Thanks Stephan

        • 1. Re: RF4 - collapsiblePanel, render problem
          mausbull

          Hi,

           

          I solved the problem by changing the switchType to "client" and using an a4j:jsFunction to register the toggle events:

           

          <rich:collapsiblePanel 
              id="panel" 
              header="My Panel"
              switchType="client"
              onbeforeswitch="managePanelToggleListener()"
              expanded="#{controller.panelOpen}"
              >
                                      
              <a4j:region>
                    
                    <!-- form stuff in here -->
          
          
                      <a4j:commandButton 
                          id="add" 
                          value="add"
                          execute="@region"
                          render="panel"
                          action="#{controller.add}">
                      </a4j:commandButton>                                    
          
              </a4j:region>
              
              <!-- uses javascript function as ajax version breaks validation -->
              <a4j:jsFunction name="managePanelToggleListener" action="#{controller.processPanel()}" immediate="true" />
              
          </rich:collapsiblePanel>
          
          
          Regards,
          Stephan