From e567a0d4653d6b7556e80739023c4d2a024c8432 Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 28 Feb 2022 14:11:57 +0200 Subject: [PATCH] fix et2-select use first option, not just empty_lable, if value is not in options --- api/js/etemplate/Et2Select/Et2Select.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/Et2Select/Et2Select.ts b/api/js/etemplate/Et2Select/Et2Select.ts index 5bb61a1ea7..a1214df1be 100644 --- a/api/js/etemplate/Et2Select/Et2Select.ts +++ b/api/js/etemplate/Et2Select/Et2Select.ts @@ -235,8 +235,8 @@ export class Et2Select extends Et2WidgetWithSelect { if(this.get_select_options().length > 0 && this.get_select_options().filter((option) => option.value == this.modalValue).length === 0) { - // Not in list, clear it - this.modalValue = ""; + // Not in list, use first option + this.modalValue = this.get_select_options()[0]?.value || ""; } // Re-set value, the option for it may have just shown up this._inputNode.value = this.modalValue || "";