【发布时间】:2018-03-21 13:41:15
【问题描述】:
我是流星新手,我对来自 aldeed/meteor-autoform 的流星自动生成有疑问
我想实现一个多选框。
Exercises = new Mongo.Collection('exercises');
ExerciseSchema = new SimpleSchema({
name: {
label: "Name",
type: String
},
tags: {
label: "Tags",
type: Tags
}});
Tags = new SimpleSchema({
wow: {
type: String,
allowedValues: ['red', 'green', 'blue'],
autoform: {
options: [
{label: "Red", value: "red"},
{label: "Green", value: "green"},
{label: "Blue", value: "blue"}
]
}
}});
然后在我的 html 中插入
{{#autoForm collection="Exercises" id="insertExerciseForm" type="insert" resetOnSuccess=true}}
<div class="card-content">
{{> afQuickField name='tags.wow' type='select-multiple'}}
</div>
在浏览器中看起来是正确的 Multiple select box select
但是当我选择多个元素并从我的 Autoform 中单击提交按钮时,我在浏览器控制台中收到此错误:
Error in insertExerciseForm insert Error: Wow must be of type String
当我从 afQuickField 中删除 type='select-multiple' 时,我只能选择一个元素并且它工作正常。但我需要选择多个元素
有人可以帮我吗?
【问题讨论】:
标签: mongodb meteor meteor-autoform simple-schema