diff --git a/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts b/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts index 7f22574716..e3daa59221 100644 --- a/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts +++ b/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts @@ -33,7 +33,7 @@ export declare class Et2InputWidgetInterface public get_value() : any; - public getValue() : any; + public getValue(submit_value? : boolean) : any; public set_readonly(boolean) : void; @@ -358,18 +358,29 @@ const Et2InputWidgetMixin = >(superclass : T) this.requestUpdate("readonly"); } - public get readonly() { return this.__readonly}; + public get readonly() + { + return this.__readonly; + } - set readOnly(new_value) {this.readonly = new_value;} + set readOnly(new_value) + { + this.readonly = new_value; + } /** * Lion mapping * @deprecated */ get readOnly() - { return this.readonly}; + { + return this.readonly; + } - getValue() + /** + * @param boolean submit_value true: call by etemplate2.(getValues|submit|postSubmit)() + */ + getValue(submit_value? : boolean) { return this.readonly || this.disabled ? null : ( // Give a clone of objects or receiver might use the reference diff --git a/api/js/etemplate/et2_core_inputWidget.ts b/api/js/etemplate/et2_core_inputWidget.ts index 8b0dc6260c..76a24d7233 100644 --- a/api/js/etemplate/et2_core_inputWidget.ts +++ b/api/js/etemplate/et2_core_inputWidget.ts @@ -312,7 +312,10 @@ export class et2_inputWidget extends et2_valueWidget implements et2_IInput, et2_ return this.getValue(); } - getValue() + /** + * @param boolean submit_value true: call by etemplate2.(getValues|submit|postSubmit)() + */ + getValue(submit_value? : boolean) { var node = this.getInputNode(); if (node) diff --git a/api/js/etemplate/et2_widget_htmlarea.ts b/api/js/etemplate/et2_widget_htmlarea.ts index 8c8a43caf8..f5c89cafba 100644 --- a/api/js/etemplate/et2_widget_htmlarea.ts +++ b/api/js/etemplate/et2_widget_htmlarea.ts @@ -541,13 +541,15 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable this.value = _value; } - getValue() + /** + * @param boolean submit_value true: call by etemplate2.(getValues|submit|postSubmit)() + */ + getValue(submit_value? : boolean) { if (this.editor) { - // are we called by etemplate2.getValues() (has a closure result) - // not always setting it, as getValue() is called a lot, e.g. to test input is dirty - if (this.options.applyDefaultFont && this.getInstanceManager().get_values) + // not always applying defaut font, as getValue() is called a lot, e.g. to test input is dirty + if (this.options.applyDefaultFont && submit_value) { this.applyDefaultFont(); } diff --git a/api/js/etemplate/etemplate2.ts b/api/js/etemplate/etemplate2.ts index 096fc7d414..3b2e655667 100644 --- a/api/js/etemplate/etemplate2.ts +++ b/api/js/etemplate/etemplate2.ts @@ -1216,11 +1216,6 @@ export class etemplate2 } } - /** - * Flag that getValues() is running - */ - get_values = false; - /** * Fetches all input element values and returns them in an associative * array. Widgets which introduce namespacing can use the internal _target @@ -1231,8 +1226,6 @@ export class etemplate2 */ getValues(_root : et2_widget, skip_reset_dirty : boolean) { - this.get_values = true; - const result = {}; // Iterate over the widget tree @@ -1292,7 +1285,7 @@ export class etemplate2 id = typeof _target == "undefined" ? 0 : Object.keys(_target).length; } - const value = _widget.getValue(); + const value = _widget.getValue(true); // true: let widget know getValue() / submit is calling it // Check whether the entry is really undefined if(typeof _target[id] != "undefined" && (typeof _target[id] != 'object' || typeof value != 'object')) @@ -1335,8 +1328,6 @@ export class etemplate2 }, this, et2_IInput); - this.get_values = false; - egw().debug("info", "Value", result); return result; }