2012-07-23 59 views
1

我想把我的formtastic提交按钮作为链接而不是按钮。如何将一个formtastic按钮变成链接?

<%= f.actions do %> 
    <%= f.action :submit, :label => "Sign in", :as => :link %> 
<% end %> 

和上述给我一个“Formtastic :: UnsupportedMethodForAction”错误。

我发现了以下示例代码从rdoc.info/github/justinfrench/formtastic#The_Available_Inputs

<%= f.actions do %> 
    <%= f.action :submit, :as => :button %> 
    <%= f.action :cancel, :as => :link %> 
<% end %> 

和上面的代码也将失败,如果我将其更改为

<%= f.action :submit, :as => :link %> 

是:为=>:链路不支持:提交?

在此先感谢!

回答

3

它会生成<input type="button" value="Sign in">

如果您想要的响应动作使用link_to "Profile", :controller => "profiles", :action => "create", :id => @profile, :method => :post

2

你还是做到这一点使用CSS的链接。尝试类似

#submit-button-selector { 
    background: none; 
    border: none; 
    color: blue; 
    text-decoration: underline; 
    display: inline; 
}