-
-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested Meteor.users create form (profile fields wont render) #200
Comments
It should work with It is most likely because you are not including a required field (maybe Also, if your form includes a password, it would be better to use an |
I switched to using
these 3 fields however:
the page fails to load and a console.log error is displayed:
If I switch the fields as follows:
The page loads, there are no errors but the fields are missing. I will try enabling debugging mode and see if it provides any additional info. |
Shouldn't it be Also, for {{> afObjectField name='profile'}} And it will render inputs for all the properties in that object. |
Thanks for the suggestions! I am wondering if what I am trying to do is even possible/supported? Maybe I have to create a separate form for the Meteor.user().profile properties? |
I don't know why those would not work. Are you able to provide a link to an example repo demonstrating the issue? |
Here's the repo with the example project.
|
@aldeed Thanks for the help, I've found a similar issue and had to find a workaround cause I couldn't insert/update users either. I'm trying your suggested
And if I use
Any idea why this happens? Thanks. |
@afuggini , I initially go the errors you were getting. Make sure that when you declare the Schema that there is no var in front of it. So instead of See if that helps. |
@odesey, the fix is actually pretty simple. You're referencing It works with either: <fieldset>
{{> afQuickField name='email'}}
{{> afObjectField name='profile'}}
</fieldset> Or: <fieldset>
{{> afQuickField name='email'}}
{{> afQuickField name='profile.firstName'}}
{{> afQuickField name='profile.lastName'}}
{{> afQuickField name='profile.gender'}}
</fieldset> Depending on whether you want an automatic field grouper. @afuggini, see also "Should the value of schema and collection have quotation marks around it?" |
Wow, it works! That was pretty simple. Thanks for all the help! Really appreciate it! For the folks who end up here is the future simply make my original Schema look like this:
And then in your template file, this will work:
Make sure you have the helper from my original post and everything will work! Thanks again for the help @aldeed ! |
Glad to hear it. |
Hi, I've tried the above steps, I'm getting the form validating but it doesn't appear to be inserting into the Meteor user profile. I'm a complete noob to Meteor so any advice on how to get the values inserted and prepopulated on the form when the user logs in the next time would be great. I've got the schema, the helper and my template (below). When I run Meteor.users.find().fetch(); on the console I get _id, emails and services. My template looks like this:
Any ideas? |
@CaptainChainsaw, I'm not sure why you'd want them to pre-populate for an "insert" form. Usually you only set |
Hi, I'm making progress with this. I added an Accounts.onCreateUser function with the line user.profile = options.profile; I've created a Meteor method "saveProfile" and that looks like it will work. I'll try getting this to work before trying anything else. Thank you for your reply. I'll try the update/insert method again a bit later on when I've got further progress made. |
I've just tried the update method again and that's working. The schema wasn't accessible to both the client and server, so got that fixed :) |
I'm getting the label names for each field:
But when it comes to clicking the submit button, nothing happens, no errors, no console.logs and no updates in the Meteor.users collection. I've attached the schema in my collections/users.js file and I know it works with SimpleSchema because I'm able to insert users on Signup. The What can I be doing wrong? Thanks. |
Did you call |
Aldeed, thanks for your quick reply. I've tried with another collection using the following syntax:
The field is rendering and the Orgs collection document is updating as desired. How can I do the same with Meteor.users collection? |
Nevermind, I changed the schema attribute to collection="Meteor.users" and it worked like a charm. Awesome plugin, thank you very much! |
I am trying to get autoform working with a nested Meteor.users schema and cant get the profile fields to show up.
I am using the example found here:
https://github.com/aldeed/meteor-collection2#attach-a-schema-to-meteorusers
I created a schema file here:
It has the following code:
In my template I have the following:
I also tried:
Finally I created a helper like so:
Is it possible to create a single form that would allow me to create a user with this type of nested schema?
Thanks.
The text was updated successfully, but these errors were encountered: