Problem with submit form that use action="url" attribute on Flow router (Error: There is no route for...)?


#1

I use form action attribute like this to generate report (open new tab)

// Router
FlowRoutes.route('/reportgen', {
    name: 'reportgen',
    action: function (params, queryParams) {
       Console.log('Hi My Report');
    }
});

// Template
        {{#autoForm schema=EventReport id="eventReport" action="reportgen" target="_blank"}}
                    {{> afQuickField name='user'}}
                    {{> afQuickField name='type'}}

                    <button type="submit" class="btn btn-primary"> Generate</button>
                    <button type="reset" class="btn btn-default">Reset</button>
        {{/autoForm}}

// It show error
There is no route for the path: /reportgne?user=kNvsQFxxKP2SkMdSy&type=typeVal

Please help me.


#2

Your Template event for click submit or submit form has a typing error with the path.

You see, the error message is /reportgne?xxxxx instead of /reportgen?xxxxx


#3

Not template event, It is form submit btn.
(edit: There is no route for the path: /reportgen?user=kNvsQFxxKP2SkMdSy&type=typeVal).
I think that, problem with FlowRouter.notFound().


#4

Do you have meteorhacks:flow-router installed as well? Perhaps coming as a dependency from the helper or active route packages? Because they cause similar errors.


#5

Oh now it don’t have problem with this.
It is always show There is no route for the path: / for all router in browser console.

meteorhacks:picker
meteorhacks:flow-router
cottz:flow-router-auth
kadira:blaze-layout
arillo:flow-router-helpers
zimme:active-route

#6

Could you please check your /.meteor/versions file and see if there are more than one flow router’s added there (meteorhacks and kadira) and if not, what your router version is


#7

Oh it has 2 (meteorhacks and kadira).
Because other package (zimme:active-route) use old of flow router.


#8

You can wait for week or two until the helper packages get updated, or you can use the kadira version and copy over the helper source code to your project from those packages.