1

我正在将 cfs-filesystem 与 autoform 一起使用,并且我已经使用 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}}
4

0 回答 0