mardi 11 février 2020

Rails: Form helper how to convert this dropdown select into a radio button list

Ok....sigh. I have inherited this code (Rails 2.3.14) and I have been banging my head trying to figure out how to pull this off. I have this form_for that contains a dropdown select "g.select" that I need to be a list of checkboxes instead. How can this be done?

Here is the current code...

                <% 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>

Any help appreciated

Aucun commentaire:

Enregistrer un commentaire