Search code examples
meteormeteor-blazemeteor-autoformmeteor-helpermeteor-collection2

How to show options with autoform


I have added options to my Schema but autofrom is not showing the options.

My Schema:

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
  }, ...

I added the form with:

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

And the options are missing, it shows only the label: enter image description here

I'm using the following packages:

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

I have added a server/security.js file with:

BetaSignups.permit(['insert']).apply();

Solution

  • The error was in my setup, I forgot to add this js to client lib for configuring the autoform-materialize package.

    AutoForm.setDefaultTemplate('materialize');