我遇到Meteor Autoforms问题,表单无法正常呈现。
我的代码在这里:
<template name="insertBookForm">
{{> quickForm id="fields1" collection="FieldsExamples" schema=Schemas.FieldsExamples }}
</template>
FieldsExamples = new Mongo.Collection("fieldsExamples");
var Schemas = {};
Schemas.FieldsExamples = new SimpleSchema({
name: {
type: String
},
phone: {
type: String,
optional: true
},
address: {
type: Object
},
'address.street': {
type: String
},
'address.street2': {
type: String,
optional: true
},
'address.city': {
type: String
},
'address.state': {
type: String,
allowedValues: ["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"],
autoform: {
afFieldInput: {
firstOption: "(Select a State)"
}
}
},
'address.postalCode': {
type: String,
label: "ZIP"
},
contacts: {
type: Array,
optional: true
},
'contacts.$': {
type: Object
},
'contacts.$.name': {
type: String
},
'contacts.$.phone': {
type: String
}
});
这只是我从网站http://autoform.meteor.com/qfdetails
下车的简单示例我得到的是:
但是将数据输入集合
应该是正常的答案 0 :(得分:1)
您是否将架构附加到收藏中?
FieldsExamples.attachSchema(Schemas.FieldsExamples);