Cannot read property 'schema' of undefined


#1

Not sure where I’m going wrong here, please kindly assist:

Client side HTML:

> <template name="NewPerson">
>     <div class="new-person-container">
> 	 {{> quickForm collection=Person id="insertPersonForm" type="insert" class="new-person-form"}}
> 	</div>
> </template>

Client side JS:

if (Meteor.isClient) {
 Template.NewPerson.helpers({
  PersonSchema: function(){
    return schema.PersonSchema;
  }
});
}

Schema:

Person = new Mongo.Collection('person');

Person.allow({
	insert: function(userID, doc){
		return !!userID;
	}
});

const PersonSchema = new SimpleSchema({
	FirstName: {
		type: String,
		label: "First Name"
	},
	LastName: {
		type: String,
		label: "Last Name"	
	},
	IdentityNumber: {
		type: Number,
		label: "Identity Number"
	},
	Address: {
		type: String,
		label: "Address"
	},
	PhoneNumber: {
		type: Number,
		label: "Phone Number"
	},
	User: {
		type: String,
		label: "User",
		 autoValue: function(){
         return this.userId;
      },
      autoform: {
            type: "hidden", 
            label: false,
		 },
		
		},
	
	//createdAt: {
	//	type: Date,
	//	label: "Created At",
	//	autoValue: function(){
			
	//	}
	//	autoForm: {
	//		type: "hidden"
	//},
	
});

Person.attachSchema(PersonSchema);

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)