You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have list of items on my page, and each item has a form with a delete button. I know which delete button they are pressing by referencing the ID of the item, and so the correct form will get submitted.
When I try to use the following: confirmCallback: removeInvite(id) in the confirmModal, it submits the form right away. The modal still comes up fine, but the form gets submitted before I hit yes or cancel.
Is there a way to pass a value or attribute to the callback?
Here is my js
$(document).on('click', '[id^="removeInviteButton_"]', function(e) {
e.preventDefault();
var id = $(this).attr('id').replace('removeInviteButton_', '');
var name = $(this).data('manager-name');
$(e.target).confirmModal({
confirmMessage: 'Are you sure you want to remove ' + name + '?',
confirmStyle: 'danger',
confirmAutoOpen: true,
confirmCallback: removeInvite(id)
});
});
The text was updated successfully, but these errors were encountered:
Not sure if this is correct or optimal, but I was able to pass the ID to the callback this way:
$(e.target).confirmModal({
confirmMessage: 'Are you sure you want to remove ' + name + '?',
confirmStyle: 'danger',
confirmAutoOpen: true,
confirmCallback: removeInvite, id
});
then in my callback function I have:
function removeInvite() {
$('#removeInvite_' + this.id).submit();
}
In this way, multiple items can be passed to the call back if needed.
I have list of items on my page, and each item has a form with a delete button. I know which delete button they are pressing by referencing the ID of the item, and so the correct form will get submitted.
When I try to use the following:
confirmCallback: removeInvite(id)
in the confirmModal, it submits the form right away. The modal still comes up fine, but the form gets submitted before I hit yes or cancel.Is there a way to pass a value or attribute to the callback?
Here is my js
The text was updated successfully, but these errors were encountered: