0 Replies Latest reply on Dec 3, 2009 11:34 AM by trind

    rich:modalPanel hide when hitting browse back button

    trind

      Hi i use this to disable the page when ajax loads objects to the page.
      However when i leave the page and then hit the back button. The rich:modalPanel is shown and won't automaticly close.


      Anyone got a good soluition to this ?



      //Joachim





      <script>
      <script>
      var waitDialogShown = false; 

      var useTimerBeforeShowWaitDialog = true; 
      var waitDialogTimeout = 50; 
      var waitDialogTimer; 

      function showWaitDialog() { 

          //avoid attempt to show it if it is already shown 
          if (!waitDialogShown) { 
              Richfaces.showModalPanel('wait-dialog'); 
              waitDialogShown = true; 
          } 


      function onRequestStart() { 

          if (useTimerBeforeShowWaitDialog) { 
              waitDialogTimer = setTimeout("showWaitDialog();", waitDialogTimeout); 
          } else { 
              showWaitDialog(); 
          } 


      function onRequestEnd() { 

          if (waitDialogShown) { 
                Richfaces.hideModalPanel('wait-dialog'); 
                waitDialogShown = false; 
          } else if (useTimerBeforeShowWaitDialog &amp;&amp; waitDialogTimer) { 
              clearTimeout(waitDialogTimer); 
          } 
      }
      </script>



      <rich:modalPanel id="wait-dialog" resizeable="false" autosized="false" width="200" height="65" moveable="false" shadowOpacity="0"> 
         <f:facet name="header">#{localization.getTranslation('lea.pleasewait')}</f:facet> 
         <h:outputText value="#{localization.getTranslation('lea.yourrequestisbeeingproccesed')}"/> 
      </rich:modalPanel> 
      <a:status onstart="onRequestStart()" onstop="onRequestEnd()"/>