0 Replies Latest reply on May 18, 2007 11:25 AM by morhen

    Using the same modalPanel for two actions

    morhen

      Hi,
      I have rich:modalPanel with one text box in it and I want to use the same modalPanel for both adding new value and renaming nodes in the tree. In the first situation when user clicks on the Add button, modal panel will contain no text in the text box. In the second situation when users selects the node in the tree and clicks on the Rename button, modal panel will present currently selected node's name. When user clicks on the OK button in the modalPanel, save action on the server should be invoked.

      My problem is that I don't know how to recognize on the server in which situation modalPanel was is used. In my code I have:

      <h:graphicImage value="/images/add.gif" alt="#{msg.AddNode}" onclick="positionAndOpenModal()">
       <a4j:support event="onclick" actionListener="#{bean.addNodeClicked}"/>
      </h:graphicImage>
      <h:graphicImage value="/images/rename.gif" alt="#{msg.RenameNode}" onclick="positionAndOpenModal()">
       <a4j:support event="onclick" actionListener="#{bean.renameNodeClicked}"/>
      </h:graphicImage>

      When any of the buttons is clicked modalPanel is presented, but methods on the server (addNodeClicked and renameNodeClicked) are not invoked.

      Maybe somebody has other ideas how to achieve it? If not I will have to create two modalPanels - one per each action but I don't like this solution.

      regards,
      morhen