代码之家  ›  专栏  ›  技术社区  ›  canesin

如何使用自动表单显示选项

  •  0
  • canesin  · 技术社区  · 10 年前

    我已经向“模式”添加了选项,但autofrom没有显示这些选项。

    我的架构:

    BetaSignups = new Mongo.Collection("BetaSignups");
    
    BetaSignups.attachSchema(new SimpleSchema({
      segment: {
        type: String,
        label: "Segmento",
        allowedValues: ["college", "highschool", "professional"],
        autoform: {
          options: [
            {label: "Ensino superior", value: "college"},
            {label: "Ensino médio e pré-vestibular", value: "highschool"},
            {label: "Educação profissional", value: "professional"}
          ]
        }
      },
      name: {
        type: String,
        label: "Nome",
        max: 200
      }, ...
    

    我在表单中添加了:

    <template name="insertbetasignups">
      {{> quickForm collection="BetaSignups" id="insertbetasignups" type="insert"}}
    </template>
    

    如果缺少选项,则仅显示标签: enter image description here

    我正在使用以下软件包:

    meteor-platform
    materialize:materialize
    aldeed:collection2
    alanning:roles
    coffeescript
    meteorhacks:flow-router
    tap:i18n
    aldeed:autoform
    ongoworks:security
    

    我已添加服务器/安全性。js文件,包含:

    BetaSignups.permit(['insert']).apply();
    
    1 回复  |  直到 10 年前
        1
  •  0
  •   canesin    10 年前

    错误发生在我的设置中,我忘记将这个js添加到客户端lib中以配置自动表单实体化包。

    AutoForm.setDefaultTemplate('materialize');