0
votes

I have created an AutoForm update form that I am populating with the contents of a document. I am having a difficult time getting AutoForm to display the email address stored in the document.

<template name="edit_user_form">
    {{#autoForm schema=schema id="edit_user_form" type="update" collection=Meteor.users doc=selected_user_doc}}
        <fieldset>
            {{> afQuickField name="profile.first_name"}}
            {{> afQuickField name="profile.last_name"}}
        {{> afQuickField name="emails"}}
            {{> afQuickField name="status" options="allowed" noselect=true}}
            {{> afQuickField name="roles" options="allowed" noselect=true}}
            <div>
                <button type="submit" class="btn btn-primary">Submit</button>
                <button type="reset" class="btn btn-default">Reset</button>
            </div>
        </fieldset>
    {{/autoForm}}
</template>

As a result, the Emails input field is populated with "[object Object]".

Since I am only allowing one e-mail per user, what is the correct way to tell AutoForm to populate a form field with an e-mail address? Thanks.

1

1 Answers

2
votes

Yes, in meteor accounts, emails are considered an array. You can use this notation from the autoform github's issues:

{{> afQuickField name="emails.0.address"}}