Reputation: 2458
I've search high and low, and the best I've seen is this example using afQuickField. I really don't want to create "special" schemas just to be able to submit an email while creating a new Meteor user using AutoForm with SimpleSchema.
What is the exact way to create a form using AutoForm that I can use to create a new user in Meteor manually by calling Meteor.createUser()
server-side?
I understand how to use form hooks on submit...how to use afArrayField... but I just want to pass a value for emails.$.address
from a form using afFormGroup
... how??
I've tried...
{{> afFormGroup name="emails[0].address" type="text" label=false placeholder="schemaLabel" formgroup-class="o-group"}}
{{> afFormGroup name="emails.[].address" type="text" label=false placeholder="schemaLabel" formgroup-class="o-group"}}
{{> afFormGroup name="emails.$.address" type="text" label=false placeholder="schemaLabel" formgroup-class="o-group"}}
{{> afFormGroup name="emails.address" type="text" label=false placeholder="schemaLabel" formgroup-class="o-group"}}
...all to no avail. Seems like this is common enough that it should be simple.
{{> afFormGroup name="emails" type="text" label=false placeholder="schemaLabel" formgroup-class="o-group"}}
When I submit using the pattern in the link and last example above, I get an error that states "emails must be an array".
Upvotes: 0
Views: 106
Reputation: 1807
The correct way to index the first array element in this case is emails.0.address
. Have a look at the autoform docs: http://autoform.meteorapp.com/update-array-item. Also this thread might be of interest for you: https://github.com/aldeed/meteor-autoform/issues/200.
Upvotes: 0