After a form is successfully validated I would like to redirect the user to a specific page and display some values. I don't know if the way I think to use is the correct one. Here's what I tried already:
creating form in template:
{{> quickForm collection="Transactions" id="insertTransaction" type="insert"}}
then I created the hook to get called when form is validated & inserted
AutoForm.addHooks('insertTransaction',{
onSuccess: function(data){
Router.go('one', null, {query: 'amount=' + data->amount});
console.log(data);
}
});
@Michel Floyd
my one.html
<template name="one">
<div class="row">
<div class="col-sm-7">
One Page...
</div>
<div class="col-sm-5">
{{ amount }}
</div>
</div>
</template>
My code from home.js (client/home.js):
AutoForm.addHooks('insertTransaction',{
onSuccess: function(data, data2, data3){
result = Transactions.findOne(data2, { amount: 1});
amount = (result["amount"]);
Router.go('one',{amount: amount});
}
});
Here's my router code:
Router.route('/one/:amount',()=>{
name: 'one',
this.render('one', {data: this.params.amount});
});
I get "No route found named "one"" all the time.
First Create a route with
amount
as a param, i.e.Then use
Router.go('one',{amount: amount});
Note that there's no underscore next to
amount
inthis.params.amount