0

我对 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下车的简单示例

我得到的是:

[img]http://i.imgur.com/a5WbMRN.png?1[/img] 但是将数据输入集合应该是正常的

4

1 回答 1

1

您是否将架构附加到您的收藏中?

FieldsExamples.attachSchema(Schemas.FieldsExamples);
于 2015-03-21T23:26:42.113 回答