How do I use {{#autoForm}} for each individual element of [Object] array?

658 Views Asked by At

I would like to do something very similar to this question: Meteor: Custom AutoForm with array of objects

Which is to say, I want to manually layout each field within every element of the array.

The difference is, I still want to use the afArrayField with its default template, including the buttons to add and remove array items. I just want to pass my own layout to afArrayField. How do I do that?

If I did not make myself clear, please request clarification and I'll rephrase.

1

There are 1 best solutions below

0
On

What you need is probably to create a custom template (doc : https://github.com/aldeed/meteor-autoform#creating-a-custom-template).

You can do something like that (not tested) :

<template name="your_template">
    {{# autoForm [...]}}
        [...]
        {{> afQuickField name="players" template="custom_players"}}
        [...]
    {{/autoForm}}
</template>

<template name="afArrayField_custom_players">
    your custom template for players field
</template>

You can also take a look to default afArrayField template to inspire yourself :