Could anyone help me to figure out how to get around this please?
Here is the scenario:
Assume there are three types of user namely student, teacher, and parent that I want to save in my collection using useraccounts package.
Problem
In my AccountsTemplates.addField({}), I'd like to configure it in such way that signup form is displaying 3 fields for student, four for teacher, and 5 fields for parent with the help of type: hidden property depending on who the user has chosen to be from these three below options.
Who Am I?
Parent
<a href="/new-account/parent">Parent</a>
student
Teacher
Attempted solutions
- I've tried with
FlowRouterparameter and use the value provided by the user from the above options but the thing isAccountTemplateis suggested to be place in/libwhereby it's can be accessed both by the client and server but the problem isFlowRouter.getParam()doesn't work on server side. With
pub/sub, inaccount-config.jsI wrote thisif(Meteor.isServer){ Meteor.publish('getParam', function(param){ console.log(param) })}else if(Meteor.isClient){ console.log(FlowRouter.getParam('user-type') }
And in
routes.js
FlowRouter.route('/new-account/:user-type', {
action(){
Meteor.subscribe('getParam', FlowRouter.getParam('user-type');
// because here .getParam can be accessed.
}
}
It's just worked fine and reactive on server side but on client side, undefined
Thanks.
Regards,