开发者

Specifying html attributes with form_for helper methods

Is it possible to specify html attributes while using the form_for helper methods?

For example:

<% form_for @user do |f| %> 
   <%= f.labe开发者_如何学Cl :username%>
   <%= f.text_field :username %>
   <%= f.submit "Signn Up" %>
<% end %>

How would I go about specifying the class for the label? Is it possible, or do I have to resort to label()?


On mostly helpers, the last arg is a hash of html options for the element.

   <%= f.label :username, "Username", :class => "class" %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜