Getting Exception in template helper: quickFormContext with aldeed:autoform

孤者浪人 提交于 2020-01-06 16:19:45

问题


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: quickFormContext@http://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?


回答1:


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"



来源:https://stackoverflow.com/questions/32496931/getting-exception-in-template-helper-quickformcontext-with-aldeedautoform

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!