This is a migrated thread and some comments may be shown as answers.

Spaces in the autocomplete with multiple selections not working

2 Answers 149 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Boone
Top achievements
Rank 2
Boone asked on 08 Mar 2012, 07:06 PM
When I use the auto complete with the auto separator and use spaces after the separator, it does not work. As shown below in the image, I type 'France,denm', the suggest will not appear. If I type, 'France, denm' it will suggest Denmark.


2 Answers, 1 is accepted

Sort by
0
Kamen Bundev
Telerik team
answered on 09 Mar 2012, 10:09 AM
Hello Boone,

Thank  you for noticing this, seems like a bug with the separator. I've noted it for fixing and updated your points for the find.

Kind regards,
Kamen Bundev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Darron
Top achievements
Rank 1
Iron
answered on 29 Jan 2025, 03:04 PM

SOLVED!

The problem was if my separator was just a comma, then users who put in ", " (a comma and a space) the autocomplete would not filter.

Conversely, if my separator was ", " (Comma Space) then users who put just a comma would not cause the autocomplete to filter.

And for display purposes, I really prefer to include the space in my separator.

MY SOLUTION.

Use ", " (comma space) as my separator in my autocomplete.

Put the autocomplete in a div with an onkeydown event to call a function.  <div onkeydown="SeparateThis(event)">

Then a function that adds a space after any comma, and suppresses any space otherwise entered.

    function SeparateThis(e) {
        if (e.key == " ") { e.preventDefault(); }
        if (e.key == ",") { e.preventDefault(); Approvals.value = Approvals.value + ", "; }
    }

 

Tags
AutoComplete
Asked by
Boone
Top achievements
Rank 2
Answers by
Kamen Bundev
Telerik team
Darron
Top achievements
Rank 1
Iron
Share this question
or