1 2 Previous Next 17 Replies Latest reply on Apr 20, 2010 9:49 AM by grendizer Go to original post
      • 15. Re: Warn by leaving a form view with unsaved changes
        grendizer

        Hi Harut, my very last question: I was trying to make a global Input listener for the entire application. As mentioned, and because I include in each form view a standard menu (<jsp:include page="../../menu/standard_menu.jsp"></jsp:include>), the user has also the possibility without to get warned, to navigate into another view by clicking a menu item on page header. How can I realize a sort of "global" input listener which will verify by each form view, whether the inputs changed and do the same what you suggested me above for a particular view (popuping and redirecting to the corresponding view). Thanks in advance

        • 16. Re: Warn by leaving a form view with unsaved changes
          harut

          Hi, if you want to have only one action method for all components, then you have to add f:param to all your buttons/links:

          <a4j:commandButton value="Go to user list"
                             action="#{myBean.globalListener
          }"
                             oncomplete="if(#{myBean.inputChanged})Richfaces.showModalPanel('modalPanel')">   
               <f:param name="redirectToPage" value="IDENTIFICATOR_OF_PAGE" /> 
          </a4j:commandButton>

          public String globalListener() {

               //identify where action has been called... where to redirect
               String redirectToPage = FacesContext.getCurrentInstance().getExternalContext()
                  .getRequestParameterValuesMap().get("redirectToPage");

               if(isValueChanged()) {         
                   
          inputChanged = true;       

                    navigateFromModal = redirectToPage;

                    return "";

               }


               return redirectToPage;
          }

          • 17. Re: Warn by leaving a form view with unsaved changes
            grendizer

            Hi, sorry maybe I didn't explain clearly my question:

            So I have in the application several jsp views (therof form-views), which all of them include another seperate jsp page, which serves as the heading navigation menu. So I can make changes on a form-view and navigate to another page through my navigation bar. What I'm now in need of, is to implement such an input listener for the menu controls, which should verify on the concerned opened form view, if there'd be any changes and popups the confirmation dialog. So practically the same what you suggested me before, only how can I now take this in a way, that the navigation bar will be  also controlled with an input listener? I hope, I explained well the wanted functionality.

            1 2 Previous Next