How do I force a valid selection?

4 posts, 0 answers
  1. PaulMrozowski
    PaulMrozowski avatar
    80 posts
    Member since:
    Apr 2007

    Posted 17 Jul 2012 Link to this post

    I only want users to be able to leave my autocomplete field empty, or select an item from the list - I don't want them able to enter their own "new" item. How can I force a valid selection (either by clearing the invalid data, or not allowing the focus to leave the control, or some other variation)?
  2. Dimo
    Admin
    Dimo avatar
    8332 posts

    Posted 18 Jul 2012 Link to this post

    Hello Paul,

    The easiest and most logical approach is to use a DropDownList. Users will not be able to type, but once the dropdown is open and a key is pressed, the first item starting with the pressed key will be focused for faster access.

    Clearing a typed value, forcing a focused state or similar practices are not considered user-friendly.

    All the best,
    Dimo
    the Telerik team
    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. PaulMrozowski
    PaulMrozowski avatar
    80 posts
    Member since:
    Apr 2007

    Posted 18 Jul 2012 Link to this post

     Unfortunately the dropdownlist isn't really workable. In this case the user is selecting from what could be thousands of items and it needs to have the ability to search across a few fields in a table. 

    I noticed that the select event fires when the user selects a valid entry. Is there any other event available when they clear the entry, or when they have entered something that isn't valid (basically any event that would fire whenever the select doesn't, but something has changed)? I guess worse case I could hook into the onfocus/onblur of the underlying textbox and try to track this myself.
  5. Dimo
    Admin
    Dimo avatar
    8332 posts

    Posted 18 Jul 2012 Link to this post

    Hello Paul,

    You must have noticed that there is also a change event. In my opinion, it is more convenient than select.

    Regards,
    Dimo
    the Telerik team
    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