Kendo-angular: DropdownList shows invalid when we Apply Disabled to it

Created on 2 Jan 2019  路  2Comments  路  Source: telerik/kendo-angular

kendodropdownlist

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

Bug dropdowns

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 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.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simon11196 picture simon11196  路  17Comments

tsvetomir picture tsvetomir  路  32Comments

dassjosh picture dassjosh  路  23Comments

DGolverdingen picture DGolverdingen  路  19Comments

alexeykostevich picture alexeykostevich  路  16Comments