1 Reply Latest reply on Apr 15, 2011 9:22 AM by ilya_shaikovsky

    Strange Modal Panel Behaviour

    qaelbdj

      I have a problem with a modal panel. I can't close it, but just sometimes. I do the following:

      1. Press the command link to open the modal (it opens ok)
      2. Press the close button in the modal (it closes ok)
      3. Repeat 1 (it opens ok)
      4. Repeat 2 (It does not close!!!)

      Sometimes I can open and close more times before it stops working.

      Sometimes the modal opens ok but it closes automatically after 0.5 seconds ,, wtf???

       

      Here is my code.

                              <a4j:commandLink id="btnTestQuery" style="width: 130px;"

                                          styleClass="cmndLinkButton"                                

                                              onclick="testQuery();"

                                              reRender="dtbParameters, lblInputEmpty, modal_InputDBData"                               

                                              ajaxSingle="#{true}" value="Test">

                              </a4j:commandLink>   

       

                      <a4j:jsFunction name="testQuery"

                      reRender="ErrorQuery, modal_InputDBData"  action="#{extLinkBean.ReadParameters}"

                      data="#{extLinkBean.errQuery}" ajaxSingle="#{true}"

                      oncomplete="if (data == 0) {Richfaces.showModalPanel('modal_InputDBData');}

                      else {Richfaces.showModalPanel('ErrorQuery');}               

                      " />

       

       

      And modal_inputDBData is

       

           <rich:modalPanel id="modal_InputDBData" height="#{extLinkBean.modalInputHeight}" style="overflow-y:auto;">

                  <f:facet name="controls">

                      <h:panelGroup>

                          <h:graphicImage value="/resources/imgs/modal/close.png"

                              styleClass="hidelink"

                              onclick="Richfaces.hideModalPanel('modal_InputDBData');return false;" />

                      </h:panelGroup>

                  </f:facet>                                       

              </rich:modalPanel>

       

      In the ReadParameters action I make some validations and if there is an error (flag errQuery) I open modalpanel ErrorQuery, else I open modalpanel modal_InputDBData. In this case I get no error, so what I am trying to open is modal_InputDBData.

      Apparently hide command is not working.

       

       

      I debugged richfaces javascript and hide command is executing, but it ends in an if line with condition "this.shown" , it is undefined and it dies.

       

      Thank you,

        • 1. Strange Modal Panel Behaviour
          ilya_shaikovsky

          just avoid concurrent requests and things will be ok. now your a4j:commandLink calls the jsFunction on onclick and then fires it's own request.

           

          Why do you need additional jsFunction? just define all the same attributes in link. Or if need - add return false; after its call but it will deactivate link ajax.