Validation behavior for igx-combo with required attribute when using invalid or empty values in ngModel or reactive forms #14949
Labels
🐛 bug
Any issue that describes a bug
combo
forms: validation
Forms validation related, including ngModel.status aka VALID/INVALID/TOUCHED/PRISTINE etc.
forms
🆕 status: new
Description
When the igx-combo component is marked as required and initialized with an invalid value in ngModel or reactive forms, the valid property of the combo is set to true even when no valid selection is present. This behavior is inconsistent with the expected validation result, where the valid property should be false if an invalid value is provided or if the selected array is empty.
This issue is related to this PR, where more information can be found.
Steps to reproduce
Observe the following:
Repeat the above steps for an igx-combo inside a reactive form and observe similar validation behavior:
public genres: any[] = ['Action', 'Comedy', 'Adventure'];
public user: UntypedFormGroup;
Result
The valid property of igx-combo returns true even when an invalid selection or an empty array is provided, which does not align with the required validation logic.
Expected result
The valid property of igx-combo should return false if the provided value does not match any entry in the data source or if the selection is empty while required is set to true.
Attachments
Here is a sample that demonstrates the configuration.
The text was updated successfully, but these errors were encountered: