5 Replies Latest reply on Feb 14, 2009 7:19 PM by sergeysmirnov

    Modal before refresh/redirect?

    andre1001

      Hi,

      How can I show a modal before a page redirect or refresh?

      Here is an an example when you click the download button...

      http://www.jboss.org/jbossrichfaces/downloads/

      Can I accomplish this with rich:modalPanel? Do I need JS?

      Does someone have any code?

      Thanks.[/url]

        • 1. Re: Modal before refresh/redirect?
          andre1001

          More information:

          Using:

          <seam.version>2.1.0.SP1</seam.version>
          <richfaces.version>3.2.2.GA</richfaces.version>

          Tried this without sucess (It refreshes the same page and do not brings ProdutoList.xhtml):

          <h:form rendered="#{identity.loggedIn}">
           <rich:panel>
           <rich:dropDownMenu value="Option1"
           submitMode="ajax" direction="bottom-right" jointPoint="tr">
           <rich:menuItem value="Suboption1-1" onclick="Richfaces.showModalPanel('emDesenvolvimentoPanel')"/>
           </rich:dropDownMenu>
           </rich:panel>
          <h:form>
          
          .....
          
          
          <h:form>
           <rich:modalPanel id="emDesenvolvimentoPanel" left="400" top="200" width="200" height="100" >
           Funcao em desenvolvimento
           <br></br>
           <h:commandButton value="OK" onclick="Richfaces.hideModalPanel('emDesenvolvimentoPanel')">
           </h:commandButton>
           <a:support action="/ProdutoList.seam" event="onhide"></a:support>
           </rich:modalPanel>
          </h:form>
          


          • 2. Re: Modal before refresh/redirect?
            andre1001

            Tried this with some sucess (brings ProdutoList.seam, but modal remains oppened when I go back to the first page):

            <h:form>
             <rich:modalPanel id="emDesenvolvimentoPanel" left="400" top="200" width="200" height="100" >
             Função em desenvolvimento
             <br></br>
             <s:button value="OK" action="/ProdutoList.seam"></s:button>
             </rich:modalPanel>
            </h:form>
            


            Any way to close the modal before redirect?

            • 3. Re: Modal before refresh/redirect?
              thomas.m

              maybe within the "oncomplete" event of your button ?

              • 4. Re: Modal before refresh/redirect?
                andre1001

                Hi Thomas,

                It's working now with "onkeydown":

                <h:form>
                 <rich:modalPanel id="teste" left="400" top="200" width="200" height="100" >
                 Teste para redirect com hide no ModalPanel
                 <br></br>
                 <a:commandButton value="OK" action="/ProdutoList.seam" onkeydown="Richfaces.hideModalPanel('teste')">
                 </a:commandButton>
                 </rich:modalPanel>
                </h:form>
                


                • 5. Re: Modal before refresh/redirect?

                  1. modal panel with form elements MUST has own inner form
                  2. modal panel with inner form MUST NOT be wrapped with other form

                  Only after those problems are correct in your code, you can go any further.