-3
<script>
  function checkValue(){
     var checkboxes = $("input[type='checkbox']");

     if ( $('#student').val() == ""  ) {
        alert('Please select any student!');
        return false;
     }
     else {
        if(checkboxes.is(":checked")) {
           return true;
        }
     }

I have my checkboxes working just fine; I need to know how to proceed with it so that it stores the values of checkboxes to DB.

4

2 に答える 2

2

次のいずれかを使用できます。

<%= form_for :model %>
  <% f.check_box :field_name %>
<% end %>

または

<%= form_for :model %>
  <% check_box_tag :model_field_name %>
<% end %>
于 2012-07-02T11:46:39.127 に答える
1

simple_formニーズに合わせてご利用ください。非常に人気があり、formtastic の上に構築されています。

詳細については、 https://github.com/plataformatec/simple_form/を参照してください。

実装の詳細については、http: //railscasts.com/episodes/234-simple-formでも確認できます。

于 2012-07-02T11:09:54.097 に答える