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

Use different value for saving vs display #103

Open keiranvv opened 9 years ago

keiranvv commented 9 years ago

Hi

Is there a way to use the _id field of a document for saving to a collection but for searching and displaying, using a different field?

a-becker42 commented 8 years ago

I'd love to have an answer to this question too :)

mizzao commented 8 years ago

Maybe you guys just want to use the field in the settings, and event triggers to get the _id of whatever document is being selected, and just save that?

a-becker42 commented 8 years ago

I'm assuming the event you have in mind is autocompleteselect, as described in the documentation. Am I right?

The example code is:

Template.foo.events({
  "autocompleteselect input": function(event, template, doc) {
    console.log("selected ", doc);
  }
});