ここで間違っていますかわからないので、ご援助ください。テンプレートヘルパーで例外が発生しました:TypeError:未定義の 'schema'プロパティを読み取れません
以下のエラーをご覧ください。あなたは、コレクションに添付したら素早く形にスキーマを渡す必要はありません
////This is the client side JS////
if (Meteor.isClient) {
Template.NewPerson.helpers({
PersonSchema: function(){
return schema.PersonSchema;
}
});
}
////This is the schema////
Person = new Mongo.Collection('person');
Person.allow({
\t insert: function(userID, doc){
\t \t return !!userID;
\t }
});
const PersonSchema = new SimpleSchema({
\t FirstName: {
\t \t type: String,
\t \t label: "First Name"
\t },
\t LastName: {
\t \t type: String,
\t \t label: "Last Name" \t
\t },
\t IdentityNumber: {
\t \t type: Number,
\t \t label: "Identity Number"
\t },
\t Address: {
\t \t type: String,
\t \t label: "Address"
\t },
\t PhoneNumber: {
\t \t type: Number,
\t \t label: "Phone Number"
\t },
\t User: {
\t \t type: String,
\t \t label: "User",
\t \t autoValue: function(){
return this.userId;
},
autoform: {
type: "hidden",
label: false,
\t \t },
\t \t
\t \t },
\t
\t //createdAt: {
\t // \t type: Date,
\t // \t label: "Created At",
\t // \t autoValue: function(){
\t \t \t
\t // \t }
\t // \t autoForm: {
\t // \t \t type: "hidden"
\t //},
\t
});
Person.attachSchema(PersonSchema);
Error:
Exception in template helper: TypeError: Cannot read property 'schema' of undefined
////This is the error////
Exception in template helper: TypeError: Cannot read property 'schema' of undefined
at Object.quickFormContext (http://localhost:3000/packages/aldeed_autoform.js?hash=5dbf44ff89f182bd8c2512330e170ef4d5bf9582:6713:34)
at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2994:16
at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1653:16
at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3046:66
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3687:12)
at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3045:27
at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=65db8b6a8e3fca189b416de702967b1cb83d57d5:172:18)
at http://localhost:3000/packages/aldeed_autoform.js?hash=5dbf44ff89f182bd8c2512330e170ef4d5bf9582:6662:23
at wrappedArgFunc (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2903:14)
at .<anonymous> (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2616:26)
debug.js:41 Exception in defer callback: TypeError: Cannot read property 'id' of null
at .<anonymous> (http://localhost:3000/packages/aldeed_autoform.js?hash=5dbf44ff89f182bd8c2512330e170ef4d5bf9582:6551:22)
at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1875:20
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3687:12)
at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1873:29
at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2214:12)
at viewAutorun (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1872:18)
at Tracker.Computation._compute (http://localhost:3000/packages/tracker.js?hash=f525263111eb9d90f4ce1ad064f97aca4a6c1b07:339:36)
at new Tracker.Computation (http://localhost:3000/packages/tracker.js?hash=f525263111eb9d90f4ce1ad064f97aca4a6c1b07:229:10)
at Object.Tracker.autorun (http://localhost:3000/packages/tracker.js?hash=f525263111eb9d90f4ce1ad064f97aca4a6c1b07:604:11)
at Blaze.View.autorun (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1885:22)
////This is the client side HTML////
<template name="NewPerson">
<div class="new-person-container">
\t {{> quickForm collection=Person id="insertPersonForm" type="insert" class="new-person-form"}}
\t </div>
</template>
さらに詳しく問題を説明してください。 – n1c9