in your buttons definition: buttons : { "Close" : function () { if (!formChanged()) { $("#myDialog").dialog("close"); } else { $("#confirm").dialog("open"); }
} } $("#confirm").dialog({ buttons: { "Yes" : function () { $("#confirm").dialog("close"); $("#myDialog").dialog("close"); }, "No" : function () { $("#confirm").close(); } } }); One approach. Haven't tested this any though... :) Shawn Obi1 wrote:
Hi, i'm having some trouble because i'm using a dialog witch has a form in it where someone can change info about their hotel. this dialog also has 2 buttons one to close and the other to save changes. what i'm trying to accomplish is - when someone made sany change and tries to close de dialog without saving he will be prompt if he really wants to leave without saving the changes an the dialog only closes if person choses 'yes'. when closing the window clicking the 'close' button i can accomplish this, but i wanted it also to work when closing dialog using the "x" button on the top of the dialog. is this possible?