简体   繁体   English

覆盖提交按钮的路径

[英]Overriding the path of a submit button

Right now I have a submit button and the code looks like this 现在我有一个提交按钮,代码看起来像这样

<%= f.submit :class => "btn btn-primary btn-shadowed smallButton" %>

I want to specifically point that button to my signup_path . 我想将该按钮专门指向我的signup_path What's the correct syntax for doing so? 这样做的正确语法是什么? Googling hasn't helped and because of deploy constraints, I can't run this locally or deploy to heroku (it's a long story, not something that I can help in this situation) 谷歌搜索没有帮助,并且由于部署限制,我无法在本地运行或部署到heroku(这是一个很长的故事,在这种情况下我无法提供帮助)

You need to set the path in your form, submit just submits the form it belongs to. 您需要在表单中设置路径,提交只是提交其所属的表单。

If you don't want to control it by the form, perhaps you want a link instead of a submit button, you can still style the link like a button. 如果您不想通过表单来控制它,也许您想要一个链接而不是一个提交按钮,则仍然可以像按钮一样对链接进行样式设置。

See here for details on changing the form http://apidock.com/rails/ActionView/Helpers/FormHelper/form_for 请参阅此处,以获取有关更改表格的详细信息http://apidock.com/rails/ActionView/Helpers/FormHelper/form_for

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM