Masked text inside a combobox

4 posts, 0 answers
  1. Raja
    Raja avatar
    43 posts
    Member since:
    Oct 2013

    Posted 24 Jul 2014 Link to this post

    Hi ,

    I would like to have masked text inside combobox. For example value from my database will be A22345. This will appear as user starts typing. But I would like it to be displayed as A2-2345 in the combobox. How can I achieve this?
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 25 Jul 2014 Link to this post

    Hello Raja,

    Kendo ComboBox widget is not designed to be combined with Kendo MaskedTextBox widget. The only feasible  approach I can suggest you is to convert the data from "A22345" to "A2-2345" manually and then bind the widget.

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Raja
    Raja avatar
    43 posts
    Member since:
    Oct 2013

    Posted 28 Jul 2014 in reply to Georgi Krustev Link to this post

    Hi,
    Thanks for the response.

    How can I handle keyup event for the combobox? I am thinking of storing the formatted values in the database. So once the user enters two characters i will append "-" as the third character.

    Thanks,
    Raja
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 29 Jul 2014 Link to this post

    Hello Raja,

    You can wire the keyup event of the visible input element and modify its value. Please note, however, that if the value of the input cannot be found in the data source then it will be considered as a custom one and widget's value and text will be set to it. In other words if "A22345" value is selected and then modified on keyup to "A2-2345" widget will think that this is a custom value and its value and text will be set to "A2-2345", which I believe will be undesired behavior.

    The only feasible approach I can suggest is to modify the data items in the data source before binding the widget.

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready