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" ... <tr> <td><h:commandButton value="Yes" onclick="confirmEmailDelete()"/></td> <td><h:commandButton value="No" onclick="cancelEmailDelete()"/></td> </tr> ...
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})
}
function cancelEmailDelete()
{
Richfaces.hideModalPanel('deleteEmailConfirm');
Richfaces.findModalPanel('deleteEmailConfirm').emailToDelete=undefned;
}
function confirmEmailDelete()
{
// Get the handle to the panel
var email = Richfaces.findModalPanel('deleteEmailConfirm').emailToDelete;
Seam.Component.getInstance("EditProfile").deleteEmail(email.uid,
function(result)
{
// simulate cancel
cancelEmailDelete();
// update email display
Seam.Component.getInstance("EditProfile").getEmails(getEmailsCallback);
});
}