首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Meteor-Autoform不能正确渲染

Meteor-Autoform不能正确渲染
EN

Stack Overflow用户
提问于 2015-01-25 23:03:00
回答 1查看 134关注 0票数 0

我对Meteor Autoforms有问题,表单不能正确呈现。

我的代码如下:

代码语言:javascript
复制
<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
  }
});

这只是我从site http://autoform.meteor.com/qfdetails下载的简单示例

我得到的是这样的:

但将数据输入到集合中应该是正常的

EN

回答 1

Stack Overflow用户

发布于 2015-03-22 07:26:42

您是否将您的架构附加到您的集合?

代码语言:javascript
复制
FieldsExamples.attachSchema(Schemas.FieldsExamples);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28137843

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档