Javascript 在meteor中获取summernote错误
遵循中的自述之后,每当我尝试提交表单时,都会出现以下错误: 未捕获类型错误:未定义不是函数 单击错误显示以下代码:Javascript 在meteor中获取summernote错误,javascript,meteor,summernote,meteor-autoform,Javascript,Meteor,Summernote,Meteor Autoform,遵循中的自述之后,每当我尝试提交表单时,都会出现以下错误: 未捕获类型错误:未定义不是函数 单击错误显示以下代码: AutoForm.addInputType('summernote', { template: 'afSummernote', valueOut: function() { return this.code(); //This as the offending line (marked with an x) }}); 我不确定我是做错了什么,还是因为包装问题 模式 //C
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
{{{#autoForm collection=“Todos”id=“todo_create”type=“insert”}
添加待办事项
{{>afquickfieldname='name'}
{{>afQuickField name='todo_type'}
{{>afFieldInput name='description'}
添加待办事项
{{/autoForm}
{{>TABLART table=TABLARTABLES.Todos class=“table table striped table BORDED table CONNECTED”}
我们可以使用您的模式吗?您是如何配置的?@Ethaan我已经添加了itI,我在autoform方面没有跟上速度,但是这个在您的值中:
应该是初始实例化的summernote元素,而不是summernote在实例化后创建的元素,或者可能是afSummernote
模板的任何其他部分。如果是,请尝试将this
包装到jquery$(this).code()
@以下9k中,我不确定,但这不是由Adim生成的代码,而是由meteor包生成的。管理员:我没有看到错误,你有最新的2个软件包吗?还有新的流星版本?@Ethaan是对的,我没有写那个代码。我的报告不是最新的。我在autoform 4.2.2上。现在我的包裹都是最新的。我正在使用meteor 1.1.0.2,使用autoform 5.1.2和mpowaga:autoform-summernote@0.3.2. 现在,当我尝试使用上面的代码提交表单时,它会重新加载页面(仍然不提交任何内容)
<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>