Ruby Rails:Form helper如何将此下拉选择转换为单选按钮列表
好的……叹气。我继承了这段代码(Rails 2.3.14),我一直在绞尽脑汁想如何实现这一点。我有这个表单,它包含一个下拉选择“g.select”,我需要一个单选按钮列表。如何做到这一点 这是当前的代码Ruby Rails:Form helper如何将此下拉选择转换为单选按钮列表,ruby,ruby-on-rails-3,Ruby,Ruby On Rails 3,好的……叹气。我继承了这段代码(Rails 2.3.14),我一直在绞尽脑汁想如何实现这一点。我有这个表单,它包含一个下拉选择“g.select”,我需要一个单选按钮列表。如何做到这一点 这是当前的代码 <% form_for :attendance, nil, :url => {:action => "doattendance", :id => skedj.current.id}, :loading => "$(#{ loading
<% form_for :attendance, nil, :url => {:action => "doattendance", :id => skedj.current.id}, :loading => "$(#{ loading_indicator_id("attendance_assignment_form").to_json }).show();" do |g| %>
<%#= g.label :attendance_type_id %>
<% t = Time.now.to_i%>
<%= g.select("attendance_type_id",
AttendanceType.find(:all).sort_by(&:id).collect {|p| [ p.name, p.id ] },
{:include_blank => true, :selected => skedj.current.attendance_type_id},
:id => "attendance_attendance_type_id_#{t}") %>
<!-- TODO: convert to Radio Buttons?-->
<br />
????? <---- Radio Button code here
<br />
<%= g.submit "Save" %>
<%= loading_indicator_tag("attendance_assignment_form") %>
<% end %>
</div>
{:action=>“doattendence”,:id=>skedj.current.id},:loading=>“$(#{loading_indicator_id(“考勤分配表”).to_json})。show();“do | g |%>
true,:selected=>skedj.current.attention\u type\u id},
:id=>“出勤率\出勤率\类型\出勤率{t}”)%>
????? 你想要复选框还是单选按钮?这些是不同的。签出这一个,@MarekLipka单选按钮…刚刚更新了我的打字错误