ruby的form中常用的控件

1.radio_button_tag

new:
<%= radio_button_tag “feedback_type”,”T-1″ %>
<label for=’T-1′ style=’display:inline’ >T-1</label>&nbsp;&nbsp;
<%= radio_button_tag “feedback_type”,”T-2″ %>
<label for=’T-2′ style=’display:inline’>T-2</label>&nbsp;&nbsp;

edit:

<%= radio_button_tag “feedback_type”,”T-1″, @feedback.feedback_type == “T-1″%>
<label for=’T-1′ style=’display:inline’ >T-1</label>&nbsp;&nbsp;
<%= radio_button_tag “feedback_type”,”T-2″, @feedback.feedback_type == “T-2” %>
<label for=’T-2′ style=’display:inline’>T-2</label>&nbsp;&nbsp;

2.text_field_tag

<%= text_field_tag “title” %>

3.image_tag

<% if @feedback.image != nil %>
<%= image_tag @feedback.image, :width => 200 %><br/>
<% end %>
<%= s.text_field :image %>

4.select

<%= f.select :tag_type, options_for_select([[“ugc”,1],
[“豆单”,2],
[“剧集”,3]],@secondchannel.tag_type) %>

<%= f.select :layout_type, options_for_select([“album”,”item”],@secondchannel.layout_type) %>

发表评论

电子邮件地址不会被公开。 必填项已用*标注