Check whether current AutoComplete value is in suggestions

3 posts, 1 answers
  1. Josh
    Josh avatar
    72 posts
    Member since:
    Jun 2013

    Posted 14 Nov 2013 Link to this post

    Hi,

    I would like to be able to hook the 'change' event to be able to test whether the current AutoComplete value would be in the suggestions. Since the widget already searched for the value to see if it is in suggestions I would prefer to be able to check the result of that search. Something like calling kendoAutoComplete.search() but not have it affect the UI - just tell me if it was found or not. Is that possible?

    I want to be able to alter the UI if the user has entered a value that is not detected in the suggestions to let them know it is not a valid value, and it seems silly to have to manually see if the value is in the datasource (and handle the filter variants 'startsWith' and 'contains') when that is already being done by the widget. So, I'm just looking to detect whether the search done by the widget found the value in suggestions or not.
  2. Answer
    Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 18 Nov 2013 Link to this post

    Hello Joshua,

    You cannot do this out-of-the-box and you will need to loop through the dataSource items and see if you find any match manually to whatever is written inside the AutoComplete.

    In contrast to the ComboBox widget where you can use the dataItem method (and see if it is different from undefined) or the selectedIndex field and see if it is different from -1.

    Kind Regards,
    Petur Subev
    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. Josh
    Josh avatar
    72 posts
    Member since:
    Jun 2013

    Posted 18 Nov 2013 Link to this post

    Bummer. I've added a feature request so that anyone else wanting this behavior can vote for it:
    http://feedback.kendoui.com/forums/127393-kendo-ui-feedback/suggestions/5012741-check-whether-current-autocomplete-value-is-in-sug

    Thanks.
Back to Top