Created by: romanych
In case you show form in modal you might want to add confirmation on close button click. It is very easy to do:
$('#myModal').on('hide', function() {
if (!saveButtonClicked && hasChanges) {
return false;
}
});
or
$('#myModal').on('hide', function(e) {
if (!saveButtonClicked && hasChanges) {
e.preventDefault();
}
});