流星:构建自定义表单,提交后需要帮助重定向
Meteor: Building a custom form and need help redirecting after submission
编辑:我确实在表单元素中添加了action="/results"
,但它没有做任何事情。我还在我的路线上设置了页面/results
。
Meteor 的新手,我正在开发一个收集多个类别表单条目的应用程序。表单是定制的:
/*------------------- Template.html ----------------------------*/
<form class="word_of_day">
<div class="page 1 view">
<h1>Word of the day</h1>
<p>Enter the word and fill out the fields as you go.</p>
<input type="text" name="word" placeholder="Word of the day" />
</div>
<div class="page 2">
{{> day_two}}
</div>
<div class="page 3">
{{> day_three}}
</div>
<div class="page 4">
{{> day_four}}
</div>
<div class="page 5">
{{> day_five}}
<div class="error"></div>
<div class="pull-down">
<span>Would you like to send this to yourself? (not required)</span>
<input type="text" name="user_email" placeholder="Your Email" />
</div>
<button type="submit">Submit</button>
</div>
</form>
/*---------------------- app.js ---------------------------------------*/
Template.form.events({
"submit .word_of_day":function(event){
event.preventDefault();
});
目前,我有表单将数据推送到我创建的集合中,但我无法弄清楚如何在提交后重定向表单。我在应用程序上设置了流路由器,不确定是否有帮助。我感谢任何帮助和指导!
在您的活动中
"submit .word_of_day":function(event){
event.preventDefault();
Meteor.call('updateYourData', $(event.target).serializeArray(), function(err, res){
if (!err) {
FlowRouter.go('path/to/some-where');
}
});
}
相关文章:
- 通过javascript重定向html传递php变量
- JavaScript下拉菜单-点击按钮并根据所选值重定向到url
- 使用angular重定向到html页面
- 如何在chrome扩展中重定向到html页面
- 无法从jquery Mobile导航栏重定向到另一个页面
- ng视图外的链接重定向到ng视图内的页面
- 在phonegap应用程序内部重定向不起作用
- CORS-重定向到第二个GET正在接收的页面
- AJAX不会在文件上传后重定向到网页-POST方法
- 重定向时角度刷新浏览器
- 通过链接重定向不;我不在jstree中工作
- 根据select选项元素将表单重定向到不同的URL
- 通过JQuery重定向到另一个页面
- 重定向到“父窗口”
- 流星:构建自定义表单,提交后需要帮助重定向
- 硒网络驱动程序中的 Click() 操作没有帮助我重定向到另一个页面
- 需要按钮帮助从下拉菜单获取输入以进行重定向
- django -如何为Html中的Save按钮实现javascript,以帮助重定向到新url
- HTML重定向脚本帮助需要修改以显示重定向url而不是重定向
- 帮助修复Javascript重定向问题