0 Replies Latest reply on Mar 16, 2008 1:51 PM by Raj Tiwari

    rich:modalPanel: How to send parameters

    Raj Tiwari Newbie

      I had posted this originally under the Seam user forum.

      have a list of items with a Delete button next to each item. If the user hits the delete button, I would like to pop up a model dialog for confirmation before deleting the item. My problem is, I am unable to send any parameters to the modal dialog in order to display attributes of the item selected in the dialog.

      Here is a snip of the code: The modal dialog panel:

      <rich:modalPanel id="deleteEmailConfirm"
       <td><h:commandButton value="Yes" onclick="confirmEmailDelete()"/></td>
       <td><h:commandButton value="No" onclick="cancelEmailDelete()"/></td>

      This modal panel is invoked from the following JS function:
      function preDeleteEmail(email, uid)
       var emailToDelete = new Object();
       emailToDelete.email = email;
       emailToDelete.uid = uid;
       // show confirmation dialog
       var panel = Richfaces.findModalPanel('deleteEmailConfirm');
       // got to set the email in question on the panel itself since the
       // DOM is not available there
       panel.emailToDelete = emailToDelete;
       Richfaces.showModalPanel('deleteEmailConfirm',{width:400, top:200})

      And the confirmation and cancellation functions:
      function cancelEmailDelete()
       function confirmEmailDelete()
       // Get the handle to the panel
       var email = Richfaces.findModalPanel('deleteEmailConfirm').emailToDelete;
       // simulate cancel
       // update email display

      My problem is that findModalPanel always returns undefined. I cannot think of any other way to get information about the selected item to the code in the modal panel.

      Any ideas?