Javascript 我不断得到:“未捕获的TypeError:无法读取未定义的属性'insert'”
我将cfs文件系统与autoform一起使用,我已使用collectionFS和meteor cfs autoform中的文档进行了设置,但当我尝试提交表格为我的学校收藏创建记录时,出现了上述错误。我不确定我遗漏了什么,也不确定错误是在哪里产生的 common.js:Javascript 我不断得到:“未捕获的TypeError:无法读取未定义的属性'insert'”,javascript,meteor,handlebars.js,meteor-autoform,collectionfs,Javascript,Meteor,Handlebars.js,Meteor Autoform,Collectionfs,我将cfs文件系统与autoform一起使用,我已使用collectionFS和meteor cfs autoform中的文档进行了设置,但当我尝试提交表格为我的学校收藏创建记录时,出现了上述错误。我不确定我遗漏了什么,也不确定错误是在哪里产生的 common.js: // File methods Images = new FS.Collection("images", { stores: [new FS.Store.FileSystem("images", {path: "~/img/
// 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}}
你能在Meteopad上给我一个简单的演示吗?