diff --git a/api/js/etemplate/Et2Link/Et2LinkTo.ts b/api/js/etemplate/Et2Link/Et2LinkTo.ts index 13a992f2a1..c688c3b65f 100644 --- a/api/js/etemplate/Et2Link/Et2LinkTo.ts +++ b/api/js/etemplate/Et2Link/Et2LinkTo.ts @@ -358,6 +358,8 @@ export class Et2LinkTo extends Et2InputWidget(ScopedElementsMixin(FormControlMix // Clear link entry this.select.value = {app: this.select.app, id: ""}; + this.select._searchNode.clearSearch(); + this.select._searchNode.select_options = []; } /** diff --git a/api/js/etemplate/Et2Select/Et2Select.ts b/api/js/etemplate/Et2Select/Et2Select.ts index 73de819c2a..62e0cb2600 100644 --- a/api/js/etemplate/Et2Select/Et2Select.ts +++ b/api/js/etemplate/Et2Select/Et2Select.ts @@ -284,7 +284,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect) // Fixes missing empty label this.select?.requestUpdate("value"); // Fixes incorrect opening position - this.select?.popup.handleAnchorChange(); + this.select?.popup?.handleAnchorChange(); }); } @@ -581,6 +581,12 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect) protected handleValueChange(e : SlChangeEvent) { + // Only interested when selected value changes, not any nested inputs + if(e.target !== this.select) + { + return; + } + const old_value = this.__value; this.__value = Array.isArray(this.select.value) ? this.select.value.map(e => e.replaceAll("___", " ")) : diff --git a/api/js/etemplate/Et2Select/SearchMixin.ts b/api/js/etemplate/Et2Select/SearchMixin.ts index 798e46646a..574d132830 100644 --- a/api/js/etemplate/Et2Select/SearchMixin.ts +++ b/api/js/etemplate/Et2Select/SearchMixin.ts @@ -456,6 +456,7 @@ export const Et2WithSearchMixin = dedupeMixin( @keydown=${this._handleSearchKeyDown} @blur=${this._handleSearchBlur} @sl-clear=${this._handleSearchClear} + @sl-change=${this._handleSearchChange} > ${edit} @@ -613,7 +614,7 @@ export const Et2WithSearchMixin = dedupeMixin( this.remoteSearch(newValueElement, this.searchOptions).then((result : SelectOption[]) => { const option = result.find(o => o.value == newValueElement); - if(option) + if(option && !this._selected_remote.some(o => o.value == newValueElement)) { this._selected_remote.push(option); }