[英]Html page redirection in Ruby on Rails
I have one html page and in that page i have 3 buttons. 我有一个HTML页面,在该页面中,我有3个按钮。 Each button should redirect to a seperate html page.
每个按钮应重定向到单独的html页面。 Can u please look into the below code and guide me where am wrong.
你能看下面的代码,并指导我哪里错了。
<td class="span3 offset6 alignment">
<%= submit_tag 'Add To Cart', products_path %>
</td>
<td class="span3 offset9 alignment">
<%= submit_tag 'Check Out', orders_path %>
</td>
<td class="span3 offset12 alignment">
<%= submit_tag 'View Cart', viewcart_path %>
</td>
submit_tag
is used inside a form
. submit_tag
用于form
。
Is this case it looks like you want to use <%= link_to 'View Cart', viewcart_path %>
这种情况下,您是否想使用
<%= link_to 'View Cart', viewcart_path %>
submit_tag
would not have path, as its in form. submit_tag
将不具有路径,如其形式。 Path would be specified in form action attribute. 路径将在表单操作属性中指定。 You need to require
link_to
for your purpose. 您需要根据需要使用
link_to
。 Please go through this documentation for submit_tag and link_to 请仔细阅读本文档以了解Submit_tag和link_to
你可以这样使用
<%= button_to "Add To Cart", products_path, :method => "get" %>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.