jQuery dialog before close
I'm at a loss. I have hooked a beforeclose function, and that works
fine.
The issue that is killing me is when I want to close the dialog after
the beforeclose returns false, nothing happens!!
On the pnlNotesConfirmation there is a "No" button. On that "No" I
try to perform: $('#notesDialog').dialog('close'); No event action
occurs.
I tried the following line first: $('#notesDialog').dialog('option',
'beforeclose', function(ev, ui) {return true;});
Still it doesn't close.
The only way I got to work was by doing a destroy ($
('#notesDialog').dialog('destroy'); ) then re init the dialog. That
can't be right. What am I doing wrong.
Using 1.7.2
$(document).ready(function() {
$('#notesDialog').dialog({
autoOpen: false,
width: 590,
resizable: false,
draggable: false,
bgiframe: true,
modal: true,
beforeclose: function(event, ui) { return CloseNotesDialog
(); }
});
});
function CloseNotesDialog()
{
var subject = $('#<%= txtSubject.ClientID %>');
var note = $('#<%= txtNote.ClientID %>');
if (subject.val() != '' || note.val() != '')
{
var pnlNotes = $('#<%= pnlNotes.ClientID %>');
var pnlNotesConfirmation = $('#<%=
pnlNotesConfirmation.ClientID %>');
pnlNotesConfirmation.height(pnlNotes.height());
pnlNotes.hide();
pnlNotesConfirmation.show();
return false;
}
}
--