Process response to wizard button only if the state is still the same
The response is asynchronous so when the event is processed the state may have changed. Closes #14847 (grafted from 1aad63cbbba72af487eddba703c136c9b8e83060) --HG-- branch : 8.0
This commit is contained in:
+11
-3
@@ -238,11 +238,14 @@
|
||||
this.footer.empty();
|
||||
},
|
||||
_get_button: function(definition) {
|
||||
let state = this.state;
|
||||
var button = Sao.Wizard.Form._super._get_button.call(this,
|
||||
definition);
|
||||
this.footer.append(button.el);
|
||||
button.el.click(() => {
|
||||
this.response(definition);
|
||||
if (this.state === state) {
|
||||
this.response(definition);
|
||||
}
|
||||
});
|
||||
return button;
|
||||
},
|
||||
@@ -290,19 +293,24 @@
|
||||
this.footer.empty();
|
||||
},
|
||||
_get_button: function(definition) {
|
||||
let state = this.state;
|
||||
var button = Sao.Wizard.Dialog._super._get_button.call(this,
|
||||
definition);
|
||||
this.footer.append(button.el);
|
||||
if (definition['default']) {
|
||||
this.content.unbind('submit');
|
||||
this.content.submit(e => {
|
||||
this.response(definition);
|
||||
e.preventDefault();
|
||||
if (this.state === state) {
|
||||
this.response(definition);
|
||||
}
|
||||
});
|
||||
button.el.attr('type', 'submit');
|
||||
} else {
|
||||
button.el.click(() => {
|
||||
this.response(definition);
|
||||
if (this.state === state) {
|
||||
this.response(definition);
|
||||
}
|
||||
});
|
||||
}
|
||||
return button;
|
||||
|
||||
Reference in New Issue
Block a user