2 Replies Latest reply on Sep 24, 2008 9:38 AM by tkuprevich

    selectOneMenu disabled after opening popup by rerendering

    kechup

      Hi,

      I'm not sure of bug is between chair and keyboard but:

      Ihave templated page with Facelets: on the status bar there is selectOneMenu with populated names. On main page is popup which is opened by rerendiring and settig it's attribute showWhenRendered to true. After popup is closed, selectOneMenu is disabled in FF 3 and IE6.

      Code follows:

      index.jspx

       <ui:define name="content">
      
       <rich:modalPanel id="panel" width="350" height="100" showWhenRendered="#{bean.visible}">
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText value="Modal Panel"></h:outputText>
       </h:panelGroup>
       </f:facet>
       <a4j:form>
       <a4j:commandButton value="Close" id="close" reRender="panel" action="#{bean.actionClose}">
       </a4j:commandButton>
       </a4j:form>
       </rich:modalPanel>
      
       <a4j:form>
       <a4j:commandButton value="Open" id="open" reRender="panel" action="#{bean.actionOpen}">
       </a4j:commandButton>
       </a4j:form>
      
       </ui:define>


      template-richmain.jspx

       <body>
       <div id="wraper">
       <div id="header">
       <ui:include src="/components/header.jspx" />
       </div>
       <div id="sidemenu">
       <ui:include src="/components/sidemenu.jspx" />
       </div>
       <div id="content">
       <ui:insert name="content">
       <span>HC:Content</span>
       </ui:insert>
       </div>
       <div id="statusbar">
       <ui:insert name="statusbar">
       <a4j:form id="form1">
       <h:selectOneMenu id="singleMenu" value="#{bean.selectedUser}" onchange="submitMe()">
       <f:selectItems value="#{bean.users}" />
       </h:selectOneMenu>
       <a4j:jsFunction name="submitMe" action="#{bean.actionListItemChanged}" />
       </a4j:form>
       </ui:insert>
       </div>
       </div>
       </body>


      public class Bean {
       List<SelectItem> users = new ArrayList<SelectItem>();
       private String selectedUser = "Milan";
       boolean visible = false;
      
       public void actionOpen() {
       System.out.println("actionOpen");
       visible = true;
       }
      
       public void actionClose() {
       System.out.println("actionClose");
       visible = false;
       }
      
       public boolean isVisible() {
       return visible;
       }
      
       public void setVisible(boolean visible) {
       this.visible = visible;
       }
      
       public Bean() {
       users.add(new SelectItem("Jano", "Jano"));
       users.add(new SelectItem("Fero", "Fero"));
       users.add(new SelectItem("Miso", "Miso"));
       users.add(new SelectItem("Milan", "Milan"));
       }
      
       public String getSelectedUser() {
       return selectedUser;
       }
      
       public void setSelectedUser(String selectedUser) {
       this.selectedUser = selectedUser;
       }
      
       public List<SelectItem> getUsers() {
       return users;
       }
      
       public String actionListItemChanged() {
       System.out.println("actionListeItemChange()");
       return null;
       }
      
       public void actionListenerMethod(ActionEvent evt){
       System.out.println("actionListenerMethod(ActionEvent evt)");
       }
      
      
      
      }


      (There is a little workaround: When I put next to selectOneMenu any other controll, fex. <h:commandLink /> selectOneMenu will not be disabled.) (when popup is opened using rich:ComponentControll everithing works just fine. It seems that "but" is related to a4j page rerender ... ?
      Do I missunderstand something?

      Thanks Robert.

        • 1. Re: selectOneMenu disabled after opening popup by rerenderin
          saipanman95

          Hi Robert,

          I encountered this exact same problem the other. I had to wrap the
          selectOneMenu with an a4j:outputPanel with the ajaxRendered=true
          and the layout=block.

          <a4j:outputPanel layout="block" ajaxRendered="true">
           <h:selectOneMenu valueChangeListener="#{bean.uiListener}"
           required="true" id="comboID"
           requiredMessage=" Please select a position!"
           value="#{bean.pos}">
           <f:selectItems value="#{bean.beanSelectItem}"/>
           </h:selectOneMenu>
          </a4j:outputPanel>
          


          You may want to play around with setting the attribute to false also. It was
          originally recommended to me to set it to false but only worked after
          setting it to true.

          How it helps!

          Michael

          • 2. Re: selectOneMenu disabled after opening popup by rerenderin
            tkuprevich

            Dear kechup,

            I have just copied your code example and it looks like working. I used RichFaces 3.2.2.GA snapshot

            Best Regards,
            Tsikhon Kuprevich