diff --git a/lib/core/form/components/widgets/core/form-field-validator.spec.ts b/lib/core/form/components/widgets/core/form-field-validator.spec.ts index 6077d1ff35..5d9c0cd711 100644 --- a/lib/core/form/components/widgets/core/form-field-validator.spec.ts +++ b/lib/core/form/components/widgets/core/form-field-validator.spec.ts @@ -101,6 +101,18 @@ describe('FormFieldValidator', () => { expect(validator.validate(field)).toBe(false); }); + it('should fail for dropdown with null value', () => { + const field = new FormFieldModel(new FormModel(), { + type: FormFieldTypes.DROPDOWN, + value: null, + required: true, + options: [{ id: 'one', name: 'one' }], + selectionType: 'multiple' + }); + + expect(validator.validate(field)).toBe(false); + }); + it('should fail for radio buttons', () => { const field = new FormFieldModel(new FormModel(), { type: FormFieldTypes.RADIO_BUTTONS, diff --git a/lib/core/form/components/widgets/core/form-field-validator.ts b/lib/core/form/components/widgets/core/form-field-validator.ts index 5f67126b5c..a0890d66e9 100644 --- a/lib/core/form/components/widgets/core/form-field-validator.ts +++ b/lib/core/form/components/widgets/core/form-field-validator.ts @@ -60,7 +60,7 @@ export class RequiredFieldValidator implements FormFieldValidator { if (field.type === FormFieldTypes.DROPDOWN) { if (field.hasMultipleValues) { - return !!field.value.length; + return Array.isArray(field.value) && !!field.value.length; } if (field.hasEmptyValue && field.emptyOption) {