Can't get select working from AutoForm

Hi all,

This will sound simple but I can’t get the select options into my drop down form from AutoForm. Here’s my collection and schema:

export const Matchings = new Mongo.Collection('matchings');

Matchings.attachSchema(new SimpleSchema({
title: {
    type: String,
    label: "Title",
    max: 200
    autoform: {
        type: 'select',
        options: function() {
            return [{ label: "2013", value: 2013 }, { label: "2014", value: 2014 }, { label: "2015", value: 2015 }] }

And template:

<template name="matchingstemplate">
  {{#autoForm collection=Collections.Matchings id="insertBookForm" type="insert"}}
  <legend>Add a Book</legend>
  {{> afQuickField name='title'}}
<button type="submit" class="btn btn-primary">Insert</button>

The title does not show the list of options like 2014, 2015, etc. Is there something simple I’m missing? AutoForm works fine for me otherwise.

If you’re using AutoForm 6.0 then you’ll need to extend SimpleSchema to support the autoform option by calling:



Hi, I just installed that and put in the 2 lines of code, but getting this app error:

import SimpleSchema from 'simpl-schema';

Errors prevented startup:

While building for web.browser:
imports/api/getmatchings.js:15:8: Unexpected token (15:8)

While building for
imports/api/getmatchings.js:15:8: Unexpected token (15:8)

Your application has errors. Waiting for file change.

Actually it looks like I have autoform version 5.8.1. I’m having issues with installing simple schema because of a bcrypt issue (I’m on Windows). Is there an alternate way to have select options without simple schema?

I see. In that case the easiest thing to do is to use a helper that returns the options. See

try skipping: type: ‘select’

I just use

 mySelect: {
        label: "Ehuru",
        type: String,
        autoform: {
            options: [
                {label: "Home", value: "yes"},
                {label: "Away", value: "maybe"},
                {label: "Paris", value: "Sleeping"}            ]