diff --git a/projects/netgrif-components-core/src/lib/data-fields/enumeration-field/models/enumeration-field.ts b/projects/netgrif-components-core/src/lib/data-fields/enumeration-field/models/enumeration-field.ts index afcf8aac7..f1f72035b 100644 --- a/projects/netgrif-components-core/src/lib/data-fields/enumeration-field/models/enumeration-field.ts +++ b/projects/netgrif-components-core/src/lib/data-fields/enumeration-field/models/enumeration-field.ts @@ -80,9 +80,12 @@ export class EnumerationField extends DataField { } private checkKey(control: AbstractControl): ValidationErrors | null { - if (this._choices === undefined || this._choices.length === 0 || control.value === '' || control.value === undefined) { + if (control.value === '' || control.value === undefined || control.value === null) { return null; } - return this._choices.find(choice => choice.key === control.value || control.value === null) ? null : {wrongValue: true}; + if (this._choices === undefined || this._choices.length === 0) { + return {wrongValue: true}; + } + return this._choices.some(choice => choice.key === control.value) ? null : {wrongValue: true}; } }