mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-05 04:49:44 +01:00
Et2Select: Fix value got wrecked by fix_bad_value() when there are option groups
This commit is contained in:
parent
e756962f86
commit
a9fe524123
@ -280,7 +280,8 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
|||||||
const valueArray = Array.isArray(this.value) ? this.value : (!this.value ? [] : this.value.toString().split(','));
|
const valueArray = Array.isArray(this.value) ? this.value : (!this.value ? [] : this.value.toString().split(','));
|
||||||
|
|
||||||
// value not in options --> use emptyLabel, if exists, or first option otherwise
|
// value not in options --> use emptyLabel, if exists, or first option otherwise
|
||||||
if(this.select_options.filter((option) => valueArray.find(val => val == option.value)).length === 0)
|
if(this.select_options.filter((option) => valueArray.find(val => val == option.value) ||
|
||||||
|
Array.isArray(option.value) && option.value.filter(o => valueArray.find(val => val == o.value))).length === 0)
|
||||||
{
|
{
|
||||||
let oldValue = this.value;
|
let oldValue = this.value;
|
||||||
this.value = this.emptyLabel ? "" : "" + this.select_options[0]?.value;
|
this.value = this.emptyLabel ? "" : "" + this.select_options[0]?.value;
|
||||||
|
Loading…
Reference in New Issue
Block a user