My simple form on http://localhost:3000/connectSubmit:
<template name="connectSubmit">
<form>
<input type="email" class="testf form-control" id="email" placeholder="Email here"><br>
<input type="submit" value="Submit" class="submit btn btn-primary"/>
</form>
</template>
connect_submit.js:
Template.connectSubmit.events({
'submit form': function(e) {
Router.go('index');
}
});
router.js:
Router.configure({
layoutTemplate: 'layout',
});
Router.map(function() {
this.route('index', {path: '/'})
this.route('/connectSubmit')
});
Index.html:
<template name="index">
<a href="/connectSubmit" class="btn btn-default">Connect</a>
</template>
When i'm submitting form, url is: http://localhost:3000/connectSubmit? and no redirecting me to index page
When you submit a form in HTML, the default behaviour will be to issue an HTTP POST request and reload the page, breaking the single page web app experience, what you need to do is preventing this default behaviour so happen :
Template.connectSubmit.events({
'submit form': function(e) {
e.preventDefault();
Router.go('index');
}
});