2017-01-22 10 views
1

LevelUpTutsの "Intermediate Meteor Tutorial#8 - Insert Permissions、Publishing & Meteor Toys"を実行していますが、私のフォームではフォームを送信できません。ここ流星1.4を実行している右のimが私のコードメテオクイックフォームは提出していません

私Recipes.jsが

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); 

私recipes.js

Meteor.subscribe('recipes'); 

私NewRファイルでありますecipe.js

<template name="NewRecipe"> 
    <div class="new-recipe-container"> 
     {{> quickForm collection="Recipes" id="insertRecipeForm" type="insert" class="new-recipe-form"}} 
    </div> 
</template> 

とpublis.jsファイル

Meteor.publish('recipes', function(){ 
    return Recipes.find({author: this.userId}); 
}); 

は、私は、少なくともあなたのための答えを(持っていない私は間違っ

答えて

0

をやっているか知っている私はいけない私を助けてください私はいくつかのフォーマットされたコードを提供できるので、私は答えとしてこれを投稿しています。

あなたはNewRecipe.jsの下にいくつかのコードを投稿しましたが、私はそのビューコードがNewRecipe.htmlであると仮定します。 2つの物事試してみてください:

最初に、NewRecipe.js onCreated()でこのコードを配置:QuickFormのためのいくつかのデバッグを可能にします

SimpleSchema.debug = true; 
AutoForm.addHooks(null, { 
    onError: function(name, error, template) { 
     console.log(name + " error:", error); 
    } 
}); 

を。

第2のスキーマ定義では、Recipes.allow()ブロックをコメントアウトして、データの保存をブロックしているかどうかを確認します。

次に、どのように進行するかを報告します。

+0

こんにちはZimはあなたの助けてくれてありがとうございますが、今日私のサイトをもう一度開いて、今すぐクイックフォームのサイト全体が表示されません。フロールータは大丈夫ですが、テストページでチェックして、そこに単語テストだけで表示されましたが、その中にクイックフォームのコマンドを置いたときに、ページ全体が再び白くなってしまいました - >私はquickformを再インストールしましたが、昨日よりも後になってしまったので – Michael

関連する問題