Why ComboBox .text() is automaticly copied to .value

4 posts, 0 answers
  1. VasVas
    VasVas avatar
    31 posts
    Member since:
    Nov 2012

    Posted 10 May 2015 Link to this post

    Dear Telerik,

    I have the fallowing problem reported by my QA team on a page with moltipale comboboxs the value of the combo shows up as the combo syncs with server data the it disappears and is synced.

    As I was checking this I see that the fields .value() and text(). of the kendo ui ComboBox have this strange behavior. They sync with each other. When I change the text in the combo box value is set to the text current value. This can be seen an the kendo ui demo basic usage , by writing "Item 4" in the combo and the value() and the text() of the combo will both be "Item 4". This could cause problem if the data arrived at the server when a code is expected. In my view .text should not be synced to the .value. If there  selection of the value.

     here is a disction of this :

     

    http://stackoverflow.com/questions/18870746/avoid-combobox-sending-values-that-arent-on-the-list

     

    Yours,

     

    Ariel

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 12 May 2015 Link to this post

    Hello Ariel,

    Generally speaking, the main purpose of the Kendo UI ComboBox is to allow custom values along with selection from a predefined list. When typed text is not part of the datasource, then it is considered as custom and both text and value are synced. This is the main difference (to be honest, it is the only one) between combobox and dropdownlist.

    If you would like to prevent custom values, then the best solution is to use DropDownList. If using a dropdownlist is not possible, then please refer to this how-to demo that demonstrates how to clear the entered custom value.

    To sum up, the described behavior is expected and intended. If this is not desired, then the best solution will be to use DropDownList.

    Regards,
    Georgi Krustev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. VasVas
    VasVas avatar
    31 posts
    Member since:
    Nov 2012

    Posted 17 May 2015 in reply to Georgi Krustev Link to this post

    Dear Georgi,

    I wanted to know if using the code from the cascade event is not better then working with the change event.

    This will prevent the by pruduct ("of the By design behavior") that in screens with multiple combo boxes , the code (value) is shown in the combo box . if  1= male 2=female. the combo will show 1 for a second and then sync. If I use the code you gave me and implement in the cascade event instead of the change event this will cancel this behavior. or must I implement in both events (that will cause a infinite recursive loop?)

     

    Ariel

     

     

  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 20 May 2015 Link to this post

    Hello Ariel,

    Using "cascade" event should be sufficient to accomplish your goal (clearing the custom value). That being said, you can go only for the "cascade" event.

    Regards,
    Georgi Krustev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET MVC is VS 2017 Ready