Reputation: 361
I have a select dropdown with a list of users first names from the Meteor.users collection. I want to add the selected users ID as a property of another collection when submitting the form. What is the best way to get that users ID?
Is there an easier way?
Upvotes: 0
Views: 65
Reputation: 58542
Code is useful to help clarify. But if I understand correctly the way I would have done it was to populate the dropdown with id
/ name
. So the <option>
display would be name
, but the value that is selected would be _id
.
<select class="" id="user_select" >
{{#each my_users }}
<option value="{{_id}}">{{userName}}</option>
{{/each}}
</select>
my_users would return objects like [{_id: xxxxx, userName: "nix" }, { ..} ]
Upvotes: 1