forked from extern/egroupware
stopping buttons in dialog from submitting it to server-side
This commit is contained in:
parent
c5b8261ec2
commit
196024a454
@ -180,7 +180,7 @@ export const ButtonMixin = <T extends Constructor>(superclass : T) => class exte
|
|||||||
_handleClick(event : MouseEvent) : boolean
|
_handleClick(event : MouseEvent) : boolean
|
||||||
{
|
{
|
||||||
// ignore click on readonly button
|
// ignore click on readonly button
|
||||||
if(this.disabled || this.readonly)
|
if(this.disabled || this.readonly || event.defaultPrevented)
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
|
@ -414,14 +414,15 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this._button_id = ev.target?.getAttribute("button_id") ? parseInt(ev.target?.getAttribute("button_id")) : (ev.target?.getAttribute("id") || null);
|
this._button_id = ev.target?.getAttribute("button_id") ? parseInt(ev.target?.getAttribute("button_id")) : (ev.target?.getAttribute("id") || null);
|
||||||
|
|
||||||
// Handle anything bound via et2 onclick property
|
|
||||||
try
|
|
||||||
{
|
|
||||||
let et2_widget_result = super._handleClick(ev);
|
|
||||||
// we always need to stop the event as otherwise the result would be submitted to server-side eT2 handler
|
// we always need to stop the event as otherwise the result would be submitted to server-side eT2 handler
|
||||||
// which does not know what to do with it, as the dialog was initiated from client-side (no eT2 request)
|
// which does not know what to do with it, as the dialog was initiated from client-side (no eT2 request)
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
// Handle anything bound via et2 onclick property
|
||||||
|
try
|
||||||
|
{
|
||||||
|
let et2_widget_result = super._handleClick(ev);
|
||||||
if(et2_widget_result === false)
|
if(et2_widget_result === false)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -432,15 +433,10 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Callback expects (button_id, value)
|
// Callback expects (button_id, value)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
let callback_result = this.callback ? this.callback(this._button_id, this.value, ev) : true;
|
let callback_result = this.callback ? this.callback(this._button_id, this.value, ev) : true;
|
||||||
// we always need to stop the event as otherwise the result would be submitted to server-side eT2 handler
|
|
||||||
// which does not know what to do with it, as the dialog was initiated from client-side (no eT2 request)
|
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
|
||||||
if(callback_result === false)
|
if(callback_result === false)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user