diff --git a/src/Umbraco.Core/PropertyEditors/Validators/MultipleValueValidator.cs b/src/Umbraco.Core/PropertyEditors/Validators/MultipleValueValidator.cs index ed1d11ad18..9cde751afc 100644 --- a/src/Umbraco.Core/PropertyEditors/Validators/MultipleValueValidator.cs +++ b/src/Umbraco.Core/PropertyEditors/Validators/MultipleValueValidator.cs @@ -48,7 +48,7 @@ public class MultipleValueValidator : IValueValidator } var invalidValues = values - .Where(x => valueListConfiguration.Items.Contains(x) is false) + .Where(x => x.IsNullOrWhiteSpace() is false && valueListConfiguration.Items.Contains(x) is false) .ToList(); if (invalidValues.Count == 1) diff --git a/src/Umbraco.Web.UI.Client/src/packages/property-editors/dropdown/property-editor-ui-dropdown.element.ts b/src/Umbraco.Web.UI.Client/src/packages/property-editors/dropdown/property-editor-ui-dropdown.element.ts index e077081df6..5622585166 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/property-editors/dropdown/property-editor-ui-dropdown.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/property-editors/dropdown/property-editor-ui-dropdown.element.ts @@ -78,7 +78,7 @@ export class UmbPropertyEditorUIDropdownElement // If selection includes a value that is not in the list, add it to the list this.#selection.forEach((value) => { - if (!this._options.find((item) => item.value === value)) { + if (value !== '' && !this._options.find((item) => item.value === value)) { this._options.push({ name: `${value} (${this.localize.term('validation_legacyOption')})`, value, @@ -109,7 +109,7 @@ export class UmbPropertyEditorUIDropdownElement this.#setValue(value ? [value] : []); } - #onChangeMulitple(event: Event & { target: HTMLSelectElement }) { + #onChangeMultiple(event: Event & { target: HTMLSelectElement }) { const selected = event.target.selectedOptions; const value = selected ? Array.from(selected).map((option) => option.value) : []; this.#setValue(value); @@ -155,7 +155,7 @@ export class UmbPropertyEditorUIDropdownElement } return html` - ${map( this._options, (item) => html``, diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/MultiValuePropertyEditorTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/MultiValuePropertyEditorTests.cs index 599a047c16..b1f4f76085 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/MultiValuePropertyEditorTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/MultiValuePropertyEditorTests.cs @@ -128,6 +128,7 @@ public class MultiValuePropertyEditorTests Assert.AreEqual("Item 3", result.Items[2]); } + [TestCase("", true, "")] [TestCase("Red", true, "")] [TestCase("Yellow", false, "notOneOfOptions")] [TestCase("Red,Green", true, "")]