blaze-tabs
blaze-tabs copied to clipboard
Autoform 'update' form data not showing within tabs
I am trying to group autoform fields into individual tabs but the data on an 'update' form is all blank. I am just using the basic tabs example. Here is what the autoform template looks like...
<template name="updateRecipe">
<h1>Update Recipe - {{recipeName}}</h1>
{{#basicTabs name="" tabs=tabs}}
{{#autoForm collection="Recipes" id="updateRecipeForm" type="method-update" meteormethod="updateRecipe" doc=this class="form-inline"}}
{{#tabContent slug="details"}}
{{> afQuickField name='recipeName'}}
{{> afQuickField name='purpose'}}
{{> afQuickField name='source'}}
{{> afQuickField name='description' rows=6}}
{{> afQuickField name='image'}}
{{/tabContent}}
{{#tabContent slug="ingredients"}}
<h3>Ingredients</h3>
{{> afQuickField name='yieldWeightPerUnit'}}
{{> afQuickField name='yieldNumberOfUnits'}}
{{> afArrayField name='recipeIngredients'}}
{{/tabContent}}
{{#tabContent slug="method"}}
<h3>Method</h3>
{{> afArrayField name='method'}}
{{/tabContent}}
<button type="submit" class="btn btn-primary">Update</button>
{{/autoForm}}
{{/basicTabs}}
</template>
Not sure if it's related but I am using iron router for the update page like this...
Router.route('/recipes/update/:_id', function () {
var item = Recipes.findOne({_id: this.params._id});
this.render('updateRecipe', {data: item});
}, {
name: 'recipe.show'
});
So just to clarify. If I don't use the tabs in the template, all the data from the document shows up as it should. If I use the tabs, all the fields are blank.
Thanks
I think this is more a problem with autoform. It probably expects the form context to be in the immediate parent to the form fields and doesn't iterate up contexts until it finds the form. I'm not totally sure, but I did write such functionality into templates:forms so this is the first thing that comes to mind.