2
我希望能夠從用戶列表中選擇多個用戶。如何生成一個表單以選擇在流星中使用Autoform和Collection2的用戶?
我是用戶collection2
,simple-schema
和autoform
。
我想爲此生成一個簡單的快速表單。這裏是我的簡單模式:
Schemas.Item = new SimpleSchema({
name: {
type: String,
label: "Name",
max: 100
},
userIds: {
type: [String],
regEx: SimpleSchema.RegEx.Id
}
});
望着autoform docs,我注意到,我想有一個選擇視圖,所以我需要在選項傳遞。
我希望能夠在我的模式中做到這一點!
userIds: {
type: [String],
regEx: SimpleSchema.RegEx.Id
options: function() {
// return users with {value:_id, label:username}
}
}
否則,我必須生成一個帶有quickFormFields的模板來傳遞選項。
只是堆東西上,不應該有任何重複的用戶id ...
感謝所有幫助