2 Replies Latest reply on Aug 17, 2009 10:54 PM by luxspes

    close modalPanel without form submission or AJAX

    asookazian

      I'm trying theses two options:


      <a href="#" onclick="Richfaces.hideModalPanel('mpanelEquipmentProcessingView');">Close</a>
                     <a4j:commandButton type="button" 
                                            value="Close"
                                            action="null" 
                                            onclick="Richfaces.hideModalPanel('mpanelEquipmentProcessingView');"/>



      but we need a button.


      I don't want any ajax activity when I click this b/c we have a please wait modalPanel that gets shown on any ajax req/resp activity.


      what's the best solution for this using a button?  thx.

        • 1. Re: close modalPanel without form submission or AJAX

          Arbi Sookazian wrote on Aug 17, 2009 20:44:


          I'm trying theses two options:

          <a href="#" onclick="Richfaces.hideModalPanel('mpanelEquipmentProcessingView');">Close</a>
                         <a4j:commandButton type="button" 
                                                value="Close"
                                                action="null" 
                                                onclick="Richfaces.hideModalPanel('mpanelEquipmentProcessingView');"/>



          but we need a button.


          The call Richfaces.hideModalPanel('mpanelEquipmentProcessingView'); is pure javascript, if you do not want AJAX, just plain call it, as if AJAX didn't exist


          When you say but we need a button does that mean you want to do it wihout a button?




          I don't want any ajax activity when I click this b/c we have a please wait modalPanel that gets shown on any ajax req/resp activity.

          what's the best solution for this using a button?  thx.


          Well, the easiest looking at your code would be:


          <a4j:commandButton value="Close"
          onclick="Richfaces.hideModalPanel('mpanelEquipmentProcessingView'); return false;" />
          
          



          See the return false; ? after the call to hideModalPanel? That does the trick, if onclick returns false, nothing else is done.

          • 2. Re: close modalPanel without form submission or AJAX

            You may also use Richfaces.hideTopModalPanel() to close the top modal panel, it has the advantage that you do not need to know the id of the modal panel