Getting Exception in template helper: quickFormContext with aldeed:autoform

I'm having an issue with aldeed:autoform which I can't solve, nor understand what is the cause. The template:

<template name="staffCaseEdit">
  {{> quickForm collection=Cases id="inserNewItem" type="insert"}}
</template>

I use aldeed:collection2 and aldeed:simple-schema to manage collections. So, I have the Case schema and Cases collection, both defined in /lib so they should be available on the client side, too.

Next, there's the route:

FlowRouter.route('/staff/case/:id', {
    triggersEnter: [
        AccountsTemplates.ensureSignedIn
    ],
    subscriptions: function (params) {
        this.register('theCase', Meteor.subscribe('theCase', params.id));
    },
    action: function (params, queryParams) {
        return BlazeLayout.render('container', {
            main: 'staffCaseEdit',
            id: params.id
        });
    }
});

And of course, theCase is published:

Meteor.publish('theCase', function (id) {
    return Cases.find({
        id: Number(id)
    });
});

In browser console, Cases are present:

> Cases
< Object

> Cases.find().count()
< 1

Which I suggest to be sufficient for the quickForm to consume the collection properly (it requires one as one of the arguments).

The problem is that, on the client side, I'm having an error

Exception in template helper: [email protected]://localhost:3000/packages/aldeed_autoform.js?b0918af3b0bb0ae387d80c71f4230daca94cae11:6851:34

which I cannot trace. As a result, no form is being shown (actually, the whole DOM is left empty.

What should I look for? What could be the source of this particular problem?

Answers:

Answer

A bit shooting in the dark here, I don't know if it will fix your problem but it will certainly help... Use this:

<template name="staffCaseEdit">
  {{> quickForm collection="Cases" id="inserNewItem" type="insert"}}
</template>

You are passing the variable Cases to the collection parameter instead of passing it the name of the target collection "Cases"

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.