Good Morning,
Has anyone had this issue before?
Exception in template helper: Error: Person is not in the window scope
Here is my code
{{> quickForm collection="Person" id="insertPersonForm" type="insert" class="new-person-form"}}
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);
Server side code:
Meteor.publish(‘person’, function (){
return Person.find({User: this.userID});
});
Can you please format your code with the help of
```
paste code here
```
thank you for getting back to me, my apologies, I’m still new to this. I hope I did this right now.
{{> quickForm collection=“Person” id=“insertPersonForm” type=“insert” class=“new-person-form”}}
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);
Server side code:
Meteor.publish(‘person’, function (){
return Person.find({User: this.userID});
});
I managed to get round the first error using this bit of code
import { Person } from ‘Medex/Collections/Person.js’;
Template.NewPerson.helpers({
formCollection() {
return Person;
}
});
but I am not getting the following error:
Error: Can’t find npm module ‘Medex/Collections/Person.js’. Did you forget to call ‘Npm.depends’ in package.js within the ‘modules-runtime’ package?
any advice please…