fix error for typeof this.value !== 'string', eg. number, undefined, ...

This commit is contained in:
ralf 2022-05-29 09:53:41 +02:00
parent 7f1cd117a7
commit 0b547c921d

View File

@ -241,7 +241,7 @@ export class Et2Select extends Et2InvokerMixin(Et2WidgetWithSelect)
if(changedProperties.has('select_options') || changedProperties.has("value") || changedProperties.has('empty_label'))
{
const valueArray = Array.isArray(this.value) ? this.value : this.value.split(',');
const valueArray = Array.isArray(this.value) ? this.value : (!this.value ? [] : this.value.toString().split(','));
// value not in options AND NOT (having an empty label and value)
if(this.select_options.length > 0 && this.select_options.filter((option) => valueArray.find(val => val == option.value)).length === 0 &&
!(typeof this.empty_label !== 'undefined' && (this.value || "") === ""))