
If i Apply Disabled state to a DropDownlist it shows invalid, but if i remove disabled it shows the dropdownlist is valid
Example:
https://stackblitz.com/edit/angular-vqoajw?file=app%2Fapp.component.ts
Thank you for the bug @bhavinmatariya report, can confirm that it is a problem at our side.
This is actually an issue (or a design choice, depending on how you look at it) of Angular's FormControl. It seems that when a FormControl is disabled its valid property will always return false - even if you remove the required attribute from it. Refer to this example that uses a simple input element. The reasoning behind this behavior is explained here.
As a workaround, you could set the DropDownList's readonly prop to true - the validation is correct in that case. Furthermore, if you want the widget to have the disabled styles used by the Kendo Themes, you can apply the k-state-disabled class to the DropDownList. Refer to this example.
Closing the issue, as the problem is related to Angular and not to the Kendo component.
Most helpful comment
This is actually an issue (or a design choice, depending on how you look at it) of Angular's
FormControl. It seems that when aFormControlis disabled itsvalidproperty will always returnfalse- even if you remove therequiredattribute from it. Refer to this example that uses a simpleinputelement. The reasoning behind this behavior is explained here.As a workaround, you could set the DropDownList's
readonlyprop totrue- the validation is correct in that case. Furthermore, if you want the widget to have the disabled styles used by the Kendo Themes, you can apply thek-state-disabledclass to the DropDownList. Refer to this example.Closing the issue, as the problem is related to Angular and not to the Kendo component.