Open Geolim4 opened 4 weeks ago
Short description of what this feature will allow to do:
In assets/js/field-boolean.js it would be great if the Promise could dispatch a "subscribable" event:
assets/js/field-boolean.js
Replace
.then(() => { /* do nothing else when the toggle request is successful */ }) .catch(() => this.#disableField());
by
.then((responseText) => { document.dispatchEvent(new CustomEvent('ea.form.ajax.switch', { cancelable: true, detail: { response: responseText, field: this.field, error: null} })); }) .catch((reason) => { this.#disableField(); document.dispatchEvent(new CustomEvent('ea.form.ajax.switch', { cancelable: true, detail: { response: null, field: this.field, error: reason} })); });
What do you thing @javiereguiluz ?
So we can customize the behavior (e.g: with a toaster) and subscribe to the event as we would like to
Short description of what this feature will allow to do:
In
assets/js/field-boolean.js
it would be great if the Promise could dispatch a "subscribable" event:Replace
by
What do you thing @javiereguiluz ?
So we can customize the behavior (e.g: with a toaster) and subscribe to the event as we would like to