在流星中使用summernote获取错误

时间:2015-04-07 19:09:19

标签: javascript meteor summernote meteor-autoform

autoform summernote package中关注自述文件后,每当我尝试提交表单时,我都会收到错误

  

未捕获的TypeError:undefined不是函数

单击错误会显示以下代码:

AutoForm.addInputType('summernote', {
template: 'afSummernote',
valueOut: function() {
    return this.code(); //This as the offending line (marked with an x)
}});

我不确定我做错了什么,或者是包

模式

//Creating a new Collection
Todos = new Mongo.Collection("Todos");


//Defining the schema
Todos.attachSchema(new SimpleSchema({
name: {
 type:String,
 label: "Name",
 max:200
},
description: {
 type:String,
 label: "Description",
 autoform: {
   afFieldInput: {
     type: 'summernote'
   }
 }
},
todo_type: {
 type: String,
 label: "Todo Type",
 allowedValues: ['normal', 'survey'],
 defaultValue: "normal",
 autoform: {
   type: "select",
   options: function () {
     return [
      {label: "normal", value: "normal"},
      {label: "survey", value: "survey"}
    ];
  }
 }
},
survey_questions: {
 type: [Number],
 label: "Survey Questions",
 optional: true,
 autoform: {
   type: "hidden"
 },
},
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
},
last_modified: {
 type: Date,
 autoform: {
   type: "hidden",
   label: false
 },
 autoValue: function () {
    if (this.isInsert) {
        return new Date;
    } else if (this.isUpsert) {
        return {$setOnInsert: new Date};
    } else {
        this.unset();
    }
  }
 },
 created_at: {
 type: Date,
 autoform: {
   type: "hidden",
   label: false
  },
  autoValue: function () {
    if (this.isInsert) {
        return new Date;
    } else if (this.isUpsert) {
        return {$setOnInsert: new Date};
    } else {
        this.unset();
    }
   },
   denyUpdate: true
   }
  }));

html的

  <template name='todo_create'>
  {{#autoForm collection="Todos" id="todo_create" type="insert"}}
  <fieldset>
    <legend>Add a Todo</legend>
    <div style="float:left; margin-top:10px;">
    <div class="textField">
      {{> afQuickField name='name'}}
    </div>
    <div class="textField" style="margin-left:20px;">
      {{> afQuickField name='todo_type'}}
    </div>

  </div>
  <div class="descriptionText">
    {{> afFieldInput  name='description'}}
  </div>
 </fieldset>
 <button type="submit" class="btn btn-primary">Add a Todo</button>
{{/autoForm}}

<div class="tableHolder">
 {{> tabular table=TabularTables.Todos class="table table-striped table-bordered table-condensed"}}
</div>

</template>

0 个答案:

没有答案