5 Replies Latest reply on Feb 9, 2009 8:03 AM by palino

    h:selectOneListbox inside modal panel is not refreshing

      Hi,
      I have a problem with modal panel. Inside modal panel i have input rich:calendar and h:selectOneListbox. When i click on link from main page to open modal panel its calling action and rerendering modal panel to refresh its values. richCalendar is refreshed without problems and correctly but selectOneListbox is not.

      Any toughts?
      Thanks

      Action

      <a4j:commandLink id="addPointsLink" action="#{pointsBean.emptyAction}"
       value="Add Penalty Points" immediate="true"
       reRender="pointsMP" limitToList="true"
       oncomplete="Richfaces.showModalPanel('pointsMP',{width:450, top:200})">
       <f:param name="conversationPropagation" value="join"/>
       </a4j:commandLink>
      



      ModalPanel
      <rich:modalPanel id="pointsMP" autosized="true" zindex="2000"
       styleClass="formData">
       <f:facet name="header">
       <h:outputText value="Add Penalty Points" />
       </f:facet>
       <f:facet name="controls">
       <h:graphicImage value="/images/modal/close.png" style="cursor:pointer" onclick="Richfaces.hideModalPanel('pointsMP')" />
       </f:facet>
       <h:form id="pointsForm">
       <a4j:queue name="pointsInfoQueue" requestDelay="500" ignoreDupResponce="true"/>
       <h:inputHidden value="#{pointsBean.pointsIndex}" />
       <h:inputHidden value="#{pointsBean.driverIndex}" />
      
       <a4j:outputPanel id="pointsValues">
       <h:outputText id="pointsMessagesId" style ="display: none;" value="#{facesContext.maximumSeverity}"/>
       <!-- Points Details -->
       <s:decorate id="pointsDatePart" template="/WEB-INF/templates/form/formItem.xhtml">
       <ui:define name="label">Date</ui:define>
       <ui:param name="componentId" value="pointsDate"/>
       <rich:calendar id="pointsDate"
       value="#{pointsBean.date}"
       required="true">
       <f:validator validatorId="DateValidator" />
       </rich:calendar>
       </s:decorate>
      
       <s:decorate id="pointsNumberPart" template="/WEB-INF/templates/form/formItem.xhtml">
       <ui:define name="label">Penalty Points</ui:define>
       <ui:param name="componentId" value="pointsNumber"/>
       <h:selectOneListbox id="pointsNumber" size="1"
       label = "Penalty Points"
       value="#{pointsBean.number}"
       required="true">
       <f:selectItems value="#{quoteItemsBean.penaltyPointItems}"/>
       <regex:regexValidator regexid="points.penaltypts.validator1"/>
       <rich:ajaxValidator event="onblur"/>
       </h:selectOneListbox>
       </s:decorate>
       </a4j:outputPanel>
      
      
      
       <div class="space"/>
       <a4j:commandButton id="pointsButton" action="#{pointsBean.addEdit}"
       value="#{pointsBean.buttonText}" immediate="false"
       reRender="pointsValues, pointsList, driverListPanel" limitToList="true"
       oncomplete="closeMP('#{rich:clientId('pointsMessagesId')}','pointsMP');"
       styleClass="">
       <f:param name="conversationPropagation" value="join"/>
       </a4j:commandButton>
       </h:form>
       </rich:modalPanel>
      


        • 1. Re: h:selectOneListbox inside modal panel is not refreshing
          ilya_shaikovsky

          Check that new values actually called from you beans in debugger during rendering. I think ther could be ther problem with your immediate controls and component submitted values which not cleared if not applied to model.

          • 2. Re: h:selectOneListbox inside modal panel is not refreshing

            that's right values are not called. Model doesn't get updated and it renders same values as it recieves. Any idea how to avoid it?

            What i am trying to do is reset modal panel values to default when modal panel is closed by X in corner. When user click on button save them model gets updated and modal panel rerendered so there is now problem. Problem is with closing without saving.

            I was thinking about a4j:jsFunction and call it in modal panel contralls but you can't set it as type reset. Anything else i ca use?



            • 3. Re: h:selectOneListbox inside modal panel is not refreshing

              I was wrong it's possible to do it with js function. i don't know why it didn't work for me before
              Thanks for the help anyway.

              Like:

              <a4j:jsFunction name="closePoints"
               action="pointsBean.resetValues"
               oncomplete="Richfaces.hideModalPanel('pointsMP');"
               immediate="true"
               reRender="pointsValues"
               limitToList="true"
               styleClass="">
               </a4j:jsFunction>
              


              and than for controls
              <f:facet name="controls">
               <h:graphicImage value="/images/modal/close.png" style="cursor:pointer"
               onclick="closePoints();Richfaces.hideModalPanel('pointsMP');" />
               </f:facet>
              


              • 4. Re: h:selectOneListbox inside modal panel is not refreshing
                ilya_shaikovsky

                Your js function is immediate so it's not update the model values.

                • 5. Re: h:selectOneListbox inside modal panel is not refreshing

                  Yes it's true. I haven't solved it yet. My problem is that form in modal panel has ajax validation in it so input values are validated by ajax and it modifies jsf tree values with new values during ajax validation and they stay there. When i want to reset these values to default one during closing modal panel with X rather than updating values with update button i can't because modal panel values might be invalid (user can fill just half of the values) so it won't pass validation and it won't rerender that part with default values.

                  I quess what i need is rerender part of the page (modal panel form values) on click of X with default one but i don't know how to do that because i can't submit that form since it would not pass the validation so it would not refresh with new defaul values.

                  If you have any idea how to solve it i would appreciate it .
                  Hope my explanation makes sense.