How can I make a table with input fields in Meteor. I've used the example from http://autoform.meteor.com/update-each but they only use 1 input field.
The functionality works with this code:
<tbody>
{{#each persons}}
{{#autoForm id=makeUniqueID type="update" collection=Collections.Persons doc=this autosave=true}}
<tr>
<td>{{> afFieldInput name="fullName" label=false}}</td>
<td>{{> afFieldInput name="email" label=false}}</td>
<td>{{> afFieldInput name="address" label=false}}</td>
<td><button type="submit" class="btn btn-xs btn-danger">Delete</button></td>
</tr>
{{/autoForm}}
{{/each}}
</tbody>
but it created a <form>
element around each <tr>
and it screws up my html. What is the correct way to do it?
Use div
s with CSS:
<div class="table">
{{#each persons}}
{{autoform class="tr"}}
<div class="td">{{> afQuickField}}</div>
<div class="td">{{> afQuickField}}</div>
<div class="td">{{> afQuickField}}</div>
{{/autoform}}
{{/each}}
</div>
And style it as such:
.table {
display: table;
}
.tr {
display: table-row;
}
.td {
display: table-cell
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With