If I understand correctly, you want to allow the user to click the 'X' button on the top right dialog, but you do not want to allow them to close the window. You probably want to trigger a different event instead.
Try this example out in your own code with your own dialogClass:
$("#dialogId").dialog({
dialogClass: "dialogId",
title: "someTitle",
//modal: true,
//autoOpen: false,
//resizable: false,
//closeOnEscape: false,
height: 500,
width: 1000,
open : function(event, ui){
},
beforeClose: function (event, ui) {
if ($(".dialogId .ui-dialog-titlebar-close").is(":focus")) {
alert('X clicked but do not close!');
return false; // do not close dialog
}
return true; // close dialog
},
buttons: [
{ }
]
});
Essentially what's happening here is were are asking if the dialog's X button is being focused (a.k.a. clicked) and then we return false. You may trigger a different event here if you like, such as creating your own custom "Are you sure you want to cancel?" dialog popup on top.
Cheers! Good luck.
Jeffrey