SS3
On the admin Newsletter interface, how to replace form submit confirm window.confirm() with jQuery UI dialog confirm in entwine?
window.confirm() is a blocking method, so this._super(e) after it will be valid, but this._super(e) inside click callback of a jQuery UI dialog button is not since the onclick has already returned.
...
$.entwine('ss', function($) {
$('#action_doSend').entwine({
onclick: function(e) {
var message = 'Are you sure you want to send this newsletter?';
if (confirm(message)) {
this._super(e);
} else {
e.preventDefault();
return false;
}
...
Tried this
...
let self;
$.entwine('ss', function($) {
$('#action_doSend').entwine({
onclick: function(e) {
self = this;
$( "#dialog-confirm-send" ).dialog({
resizable: false,
height: "auto",
width: 400,
modal: true,
buttons: {
"Send newsletter": _ => {
self._super(e);
},
Cancel: function() {
$(this).dialog( "close" );
}
}
});
...