0 Replies Latest reply on Feb 7, 2008 1:19 PM by Ajay Gupta

    How to hide a ModalWindow when loading a form?

    Ajay Gupta Newbie

      I am using a RichFaces modal window in a page (call it the first page) to confirm with the user if we should save the changes made on the page or not. The modal window has a simple confirmation message and Yes/No buttons to save/cancel the changes. If the user clicks Yes in the modal window to save their changes, the application saves their changes and redirects the user to another page in the application. The problem is that if the user hits the Back button to go back to the first page, then the modal window again shows up. In this case, I want to show the first page without the modal window when the user does a Back button from the 2nd page to come back to the 1st page.

      This is what I have been trying:

      <body onload="Richfaces.hideModalWindow('verifyModalWindow')">

      <rich:modalPanel id="verifyModalWindow'>
      <h:form id="verifyForm">
      <h:outputText value="Changes made. Do you want to save?"/>
      <h:commandButton value="Yes" action="#{action.submitForm}"/>
      <h:commandButton value="No" action="#{action.cancelChanges}"/>