Meteor-Community-Packages / meteor-autocomplete

Client/server autocompletion designed for Meteor's collections and reactivity.
https://atmospherejs.com/mizzao/autocomplete
MIT License
350 stars 109 forks source link

Template to control selected value #91

Open dcworldwide opened 9 years ago

dcworldwide commented 9 years ago

I think we need more control over the selected value. A function to transform the value based on the selected document would solve this problem. I.e match is made on Document.X but selection result is Document.Y or something more complex (like Document.X + '-' + Document.Y)

I hit this problem when writing an emoji look up using a colon : as a token. The result was ::smile: when i wanted :smile

allanlundhansen commented 9 years ago

+1 but I guess this could also be done with just an option to exclude the token or?

leizard commented 9 years ago

+1 I love to have this feature as well

minfawang commented 9 years ago

+1

mizzao commented 9 years ago

I don't understand exactly what the request is. Can you provide an example?

minfawang commented 9 years ago

For example, an emoji's code has a name wrapped with colons like :grin:. So when user is typing in text in an input section, the expected behavior is that when user types in :, the autocompletion should be triggered. However, if we set the token to be : and try to match the emoji's code, then after the user selects the item from the suggestion list, the input content will be something like ::grin:.

minfawang commented 9 years ago

Actually there is another issue with this example. Right now if the field being matched contains character same as the token, then a new completion is triggered. So if the user types in :grin: trying to match the emoji code :grin:, this package will treat the input as :grin and :. I think sometimes this is desired, but it would be nice to have an option to allow match text "overwriting" the token.

minfawang commented 9 years ago

Another example is tagging other users. An user may wants to tag a person by searching for the real name. Let's say we match the field lastname, but when the user selects one item from the suggestion list, we may want to show username instead.

If there is a user with lastname Brown and username br012, and another person might want to type in @Brown and sees the input content as @br012.

mizzao commented 9 years ago

Hi all - I am currently working on adding autoform support and would allow the control of selected values as part of that. Any input would be appreciated.

proft commented 8 years ago

+1