Moh*_*ikh 12 validation html-select ruby-on-rails
我想在我的代码中使用rails 3中的class属性添加class属性
<div >
<%= f.label :type %><br />
<%= f.select "type_id", options_from_collection_for_select(@type,
"type_id","name"),:include_blank=>true%>
</div>
Run Code Online (Sandbox Code Playgroud)
我的问题是我想为这个select标签添加一个特定的类名以进行验证.我尝试添加
:class=>"myclassname"
Run Code Online (Sandbox Code Playgroud)
但它对我不起作用.解压我的问题
Kul*_*ini 27
您可以像这样添加类属性.检查选择
<%= f.select "type_id",
options_from_collection_for_select(@type, "type_id","name"),
{ :include_blank => true },
{ :class => 'myclassname' } %>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12772 次 |
| 最近记录: |