mdbootstrap / bootstrap-templates

A collection of free Bootstrap 5 templates.
https://mdbootstrap.com/freebies/
3.07k stars 1.02k forks source link

Bootstrap 2.3.2 Typeahead: Mouse Selection #167

Closed kmtong closed 2 years ago

kmtong commented 10 years ago

I am having a problem to use mouse click to select from the typeahead options.

This can be reproduced in the 'Typeahead' section of the example page, I typed 'c' and use the mouse to click on 'Cairo', the tags added are 'c' and 'Cairo'.

Yet, when using the 'Objects as tags' section, it exhibits different behavior. When I type 'c' and use the mouse to click on 'Cape Town', the tags show an 'empty' tag, followed by 'Cape Town', and the input box seems remains a 'c' there. The typeahead options need to be clicked one more time to get the remaining 'c' disappeared.

MillerRen commented 10 years ago

problem too.

aterrien commented 10 years ago

Can be done using a 'validate' function (new option) tested at start of 'add' function. Can you add it Tim ?

timschlechter commented 10 years ago

I think I fixed this in 3494210f743f28827249c4a98af1631ea659ccaa

Can you confirm?

timschlechter commented 10 years ago

@aterrien it was a bug caused when the addonblur was implemented. But there is a validate-like function available now: beforeItemAdd event. You could set event.cancel to true to avoid the item being add