sliptree/bootstrap-tokenfield

Selecting an Element with Arrow-Keys shows only value not label

mok-liee opened this issue · 4 comments

Hello,

if i selecting an Element in the Autocomplete List by typing the first Letter and use then the Arrow-Keys.
It will only use/show the value from the token.

I think if "label" is set, it would be better to show the label?!

Greetings

Not sure if this is related, but if I select the value from the autocomplete list using the arrow keys, it fills in both the value and the label, which probably isn't ideal behavior, to say the least.

I got the same problem too, which is not what I expected.

Same problem. It would make a lot of sense to show the label if it is available.

Duplicate of #76

But +1, I am having the same problem, it seems that the normal function of the autocomplete is to select the value on arrow-keys, there must be a way to override it.

@chinobing for duplicate tokens try

$('#tokenfield').on('tokenfield:createtoken', function (event) {
    var existingTokens = $(this).tokenfield('getTokens');
    $.each(existingTokens, function(index, token) {
        if (token.value === event.attrs.value)
            event.preventDefault();
    });
});

From #308 (comment)