ポップアップカラーボックスにフォームがあり、ユーザーがテキストボックスの1つを編集してキャンセルすると、「保存せずに終了してもよろしいですか?」のようなポップアップが必要です。現在、ポップアップが表示されていますが、ポップアップカラーボックスが既に閉じられた後に表示されています
ユーザー表ページ
$('a.openDialog').colorbox({
iframe: true,
transition: "elastic",
width: "75%", height: "90%"
});
実際のフォームページ
$(':input', 'form').bind("change", function () {
setConfirmUnload(true);
});
function setConfirmUnload(on) {
window.onbeforeunload = (on) ? unloadMessage : null;
}
function unloadMessage() {
return 'You have entered new data on this page.' +
' If you navigate away from this page without' +
' first saving your data, the changes will be' +
' lost.';
}