Hello, I tried to add a quickform to edit users profiles, but I get keep getting this error:
Exception in template helper: TypeError: Cannot read property 'mergedSchema' of undefined
at Object.quickFormContext (http://localhost:3000/packages/aldeed_autoform.js?hash=a18c62226899c358fbb26d882c56bd78f140b218:6424:38)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3051:16
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1715:16
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3103:66
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3102:27
at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=ebf9381e7fc625d41acb0df14995b7614360858a:172:18)
at http://localhost:3000/packages/aldeed_autoform.js?hash=a18c62226899c358fbb26d882c56bd78f140b218:6387:23
at wrappedArgFunc (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2960:14)
at Blaze.View.<anonymous> (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2673:26)
meteor.js?hash=27829e9…:930 Exception in defer callback: TypeError: Cannot read property 'id' of null
at Blaze.View.<anonymous> (http://localhost:3000/packages/aldeed_autoform.js?hash=a18c62226899c358fbb26d882c56bd78f140b218:6268:24)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1934:20
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1932:29
at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271:12)
at viewAutorun (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1931:18)
at Tracker.Computation._compute (http://localhost:3000/packages/tracker.js?hash=9f8a0cec09c662aad5a5e224447b2d4e88d011ef:339:36)
at new Tracker.Computation (http://localhost:3000/packages/tracker.js?hash=9f8a0cec09c662aad5a5e224447b2d4e88d011ef:229:10)
at Object.Tracker.autorun (http://localhost:3000/packages/tracker.js?hash=9f8a0cec09c662aad5a5e224447b2d4e88d011ef:604:11)
at Blaze.View.autorun (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1944:22)
meteor.js?hash=27829e9…:930 Exception in template helper: TypeError: Cannot read property 'mergedSchema' of undefined
at Object.quickFormContext (http://localhost:3000/packages/aldeed_autoform.js?hash=a18c62226899c358fbb26d882c56bd78f140b218:6424:38)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3051:16
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1715:16
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3103:66
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3102:27
at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=ebf9381e7fc625d41acb0df14995b7614360858a:172:18)
at http://localhost:3000/packages/aldeed_autoform.js?hash=a18c62226899c358fbb26d882c56bd78f140b218:6387:23
at wrappedArgFunc (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2960:14)
at Blaze.View.<anonymous> (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2673:26)
import SimpleSchema from 'simpl-schema';
// Required AutoForm setup
SimpleSchema.extendOptions(['autoform']);
const Schema = {};
Schema.Role = new SimpleSchema({
organization: {
optional: true,
type: String, //(Organization)
},
specialty: {
optional: true,
type: String,
},
location: {
optional: true,
type: String,
}, // (Location) ],
});
Schema.UserCountry = new SimpleSchema({
name: {
type: String,
},
code: {
type: String,
regEx: /^[A-Z]{2}$/,
},
});
Schema.UserProfile = new SimpleSchema({
firstName: {
type: String,
optional: true,
},
lastName: {
type: String,
optional: true,
},
birthDate: {
type: Date,
optional: true,
},
gender: {
type: String,
allowedValues: ['Male', 'Female'],
optional: true,
},
country: {
type: Schema.UserCountry,
optional: true,
},
telecom: {
type: Number,
optional: true,
},
role: {
type: Schema.Role,
optional: true,
},
});
Schema.User = new SimpleSchema({
username: {
type: String,
// For accounts-password, either emails or username is required, but not both. It is OK to make this
// optional here because the accounts-password package does its own validation.
// Third-party login packages may not require either. Adjust this schema as necessary for your usage.
optional: true,
},
emails: {
type: Array,
// For accounts-password, either emails or username is required, but not both. It is OK to make this
// optional here because the accounts-password package does its own validation.
// Third-party login packages may not require either. Adjust this schema as necessary for your usage.
optional: true,
},
'emails.$': {
type: Object,
},
'emails.$.address': {
type: String,
regEx: SimpleSchema.RegEx.Email,
},
'emails.$.verified': {
type: Boolean,
},
createdAt: {
type: Date,
},
profile: {
type: Schema.UserProfile,
optional: true,
},
// Make sure this services field is in your schema if you're using any of the accounts packages
services: {
type: Object,
optional: true,
blackbox: true,
},
// Add `roles` to your schema if you use the meteor-roles package.
// Option 1: Object type
// If you specify that type as Object, you must also specify the
// `Roles.GLOBAL_GROUP` group whenever you add a user to a role.
// Example:
// Roles.addUsersToRoles(userId, ["admin"], Roles.GLOBAL_GROUP);
// You can't mix and match adding with and without a group since
// you will fail validation in some cases.
roles: {
type: Object,
optional: true,
blackbox: true,
},
// In order to avoid an 'Exception in setInterval callback' from Meteor
heartbeat: {
type: Date,
optional: true,
},
// Status module information https://github.com/mizzao/meteor-user-status#basic-usage---online-state
// Public and sent to any client
status: {
type: Object,
optional: true,
blackbox: true,
},
});
Meteor.users.attachSchema(Schema.User);
<template name="account">
{{> quickForm collection="Meteor.users" id="update-user-profile" type="update" doc=currentUser }}
</template>