我一直得到:" Uncaught TypeError:无法读取属性'插入'未定义"

时间:2015-04-03 00:25:37

标签: javascript meteor handlebars.js meteor-autoform collectionfs

我正在使用带有autoform的cfs-filesystem,我已经使用collectionFS和meteor-cfs-autoform中的文档进行了设置,但是当我尝试提交一个表单为我创建记录时,我收到了上述错误学校收藏。我不确定我遗漏了什么或错误产生的地方

common.js:

// File methods
 Images = new FS.Collection("images", {
  stores: [new FS.Store.FileSystem("images", {path: "~/img/uploads"})]
 });

 Images.allow({
  download: function () {
  return true;
},
fetch: null
});

school_collection.js:

Schools = new Mongo.Collection("Schools");


//Defining the schema
Schools.attachSchema(schoolSchema = new SimpleSchema({
name: {
type:String,
label: "Name",
max:200
},
primary_color: {
 type:String,
 label: "Color",
 optional: true
},
sub_domain: {
 type:String,
 label: "Sub Domain",
 max:50
},
user_id:{
 type: String,
 autoform: {
  type: "hidden",
  label: false
},
autoValue: function(){
  if (this.isInsert) {
        return Meteor.userId();
    } else if (this.isUpsert) {
        return {$setOnInsert: Meteor.userId()};
    } else {
        this.unset();
    }
  },
denyUpdate:true
},
image: {
 type: String,
 label: "Logo",
 autoform: {
   afFieldInput: {
     type: "cfs-file",
     collection: "files"
   }
 }
} 
}));

school_create.html

School Create


{{#autoForm collection="Schools" id="school_create" type="insert"}}

  Add a School




      {{> afQuickField name='name'}}




      {{> afQuickField name='sub_domain'}}







    {{> afQuickField name="image"}}



Add a School
{{/autoForm}}

0 个答案:

没有答案