如何使用Meteor AutoForm和SimpleSchema引用afFormGroup中的电子邮件。$。地址?

时间:2021-12-06 17:41:11

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.

我搜索高低,我见过的最好的是使用afQuickField的这个例子。我真的不想创建“特殊”模式,只是为了能够在使用AutoForm和SimpleSchema创建新的Meteor用户时提交电子邮件。

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?

使用AutoForm创建表单的确切方法是什么,我可以通过调用Meteor.createUser()服务器端手动在Meteor中创建新用户?

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??

我理解如何使用表单挂钩提交...如何使用afArrayField ...但我只想传递一个值的电子邮件。$。地址从表单使用afFormGroup ...如何?

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".

当我使用链接中的模式和上面的最后一个示例提交时,我收到一条错误,指出“电子邮件必须是一个数组”。

1 个解决方案

#1


0  

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.

在这种情况下索引第一个数组元素的正确方法是emails.0.address。看看autoform docs:http://autoform.meteorapp.com/update-array-item。此线程也可能对您感兴趣:https://github.com/aldeed/meteor-autoform/issues/200。

#1


0  

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.

在这种情况下索引第一个数组元素的正确方法是emails.0.address。看看autoform docs:http://autoform.meteorapp.com/update-array-item。此线程也可能对您感兴趣:https://github.com/aldeed/meteor-autoform/issues/200。