Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoform 'update' form data not showing within tabs #16

Open
serkyen opened this issue Feb 13, 2016 · 1 comment
Open

Autoform 'update' form data not showing within tabs #16

serkyen opened this issue Feb 13, 2016 · 1 comment

Comments

@serkyen
Copy link

serkyen commented Feb 13, 2016

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

@jonjamz
Copy link
Owner

jonjamz commented Feb 13, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants