Declined
Last Updated: 16 Apr 2021 11:50 by ADMIN
tilt32
Created on: 16 Apr 2021 08:55
Category: ComboBox
Type: Feature Request
0
Remove string limitation for AllowCustom

Hello everyone,

in the web app we are programming, we make heavy use of the TelerikCombobox. Now the use case arises, that the user needs to be able to select a numeric value (double or int, mainly) out of an existing list of values, or if the needed value does not exist yet, provide a custom value.

In this particular case, he selects out of a range of existing article lengths or widths. Most of the time, the length or width is of a "normed" width or length (meaning the normal width / length the article would have) Since they can however produce an article in any width / length they wish to, it does happen sometimes, that the range of existing article widths / lengths is missing the desired value. Hence we thought we could make use of the AllowCustom feature of the TelerikCombobox, so that the user can provide a value themselfes, if need be.

However, the type restriction to string of the Value and Text-Field of the Items makes it rather cumbersome todo so, as a new Model class is needed which has the Text / Value fields as string and internally maps it to the desired type. In addition the user can provide input, which does not make any sense whatsoever for the underlying type.

Would it be possible, for the AllowCustom feature to work also mit numeric values? I.e. When the property the Value-field is referencing to, returns a numeric value, only numeric input is considered (somewhat similar to the NumericTextBox)?

 

Best Regards,

tilt32

1 comment
ADMIN
Marin Bratanov
Posted on: 16 Apr 2021 11:50

Hello,

The AllowCustom feature relies on taking the text from the input in the combo and putting it directly in the model. An <input type=text> will produce a string, and this is why the feature relies on that. It cannot be a different type of input because that would also break all other operations such as the filtering, which looks into the TextField, which is also a string.

Ultimately, if you want to input custom values, you can parse them from a string through a separate field in the view-model. If that parsing fails, you could show a message to the user, you could even incorporate it in form validation through a custom data annotation attribute.

Another approach you can consider is to offer your users separate UI for entering custom numbers and sizes (e.g., to also let them choose units and so on) that could be initially hidden behind a checkbox a button or other UX.

Regards,
Marin Bratanov
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.