Javascript 流星快速表单不提交
我在做LevelUpTuts的“中级Meteor教程#8-插入权限、发布和Meteor玩具”,我的问题是我无法提交表单我检查了代码5次,但我认为一切都是正确的我运行Meteor 1.4这是我的代码 my Recipes.js文件Javascript 流星快速表单不提交,javascript,html,meteor,meteor-blaze,meteor-autoform,Javascript,Html,Meteor,Meteor Blaze,Meteor Autoform,我在做LevelUpTuts的“中级Meteor教程#8-插入权限、发布和Meteor玩具”,我的问题是我无法提交表单我检查了代码5次,但我认为一切都是正确的我运行Meteor 1.4这是我的代码 my Recipes.js文件 Recipes = new Meteor.Collection('recipes'); Recipes.allow({ insert: function(userId, doc) { return !!userId; } }); RecipeSchema
Recipes = new Meteor.Collection('recipes');
Recipes.allow({
insert: function(userId, doc) {
return !!userId;
}
});
RecipeSchema = new SimpleSchema ({
name: {
type: String,
label: "Name"
},
desc: {
type: String,
label: "Description"
},
author: {
type: String,
label: "Author",
autoValue: function() {
return this.userID
},
autoform: {
type: "hidden"
},
},
createdAt: {
type: Date,
label: "CreatedAt",
autoValue: function() {
return new Date()
},
autoform: {
type: "hidden"
},
},
});
Recipes.attachSchema( RecipeSchema);
my recipes.js
Meteor.subscribe('recipes');
我的新配方.js
<template name="NewRecipe">
<div class="new-recipe-container">
{{> quickForm collection="Recipes" id="insertRecipeForm" type="insert" class="new-recipe-form"}}
</div>
</template>
请帮助我,我不知道我做错了什么我没有答案(至少还没有),但我将此作为答案发布,以便提供一些格式化代码 您在NewRecipe.js下发布了一些代码,但我假设视图代码在NewRecipe.html中。尝试两件事: 首先,将此代码放入NewRecipe.js onCreated()中: 这将为quickform启用一些调试 其次,在模式定义中,注释掉Recipes.allow()块,看看这是否就是阻止保存数据的原因
然后再汇报情况。我没有答案(至少还没有),但我将此作为答案发布,以便提供一些格式化代码 您在NewRecipe.js下发布了一些代码,但我假设视图代码在NewRecipe.html中。尝试两件事: 首先,将此代码放入NewRecipe.js onCreated()中: 这将为quickform启用一些调试 其次,在模式定义中,注释掉Recipes.allow()块,看看这是否就是阻止保存数据的原因
然后汇报进展情况。Hi Zim谢谢你的帮助,但我今天再次打开了我的网站,现在整个网站都没有显示快速表单。Flow Router还行我用一个测试页面检查了一下,里面只有一个单词test,它出现了,但是当我把快速表单的命令放进去时,整个页面又变成了白色-->所以我重新安装了快速表单,但这没有用,所以我比昨天落后了很多;(嗨,Zim,谢谢你的帮助,但我今天再次打开了我的网站,现在整个网站都没有显示快速表单。Flow Router还好,我用一个测试页面检查,只显示了test一词,但当我在其中输入快速表单的命令时,整个页面又变成了白色-->因此我重新安装了快速表单,但这确实出现了没有帮助,所以我比昨天更落后(
Meteor.publish('recipes', function(){
return Recipes.find({author: this.userId});
});
SimpleSchema.debug = true;
AutoForm.addHooks(null, {
onError: function(name, error, template) {
console.log(name + " error:", error);
}
});