Im using the Simple form gem to setup a form on my rails app. I have a list of checkboxes (about 20 options) and i want to limit the user to selecting only 3. How can i achieve this?
View:
<%= f.association :interests, :as => :check_boxes, :label => false %>
First part of the Rendered HTML
<div class="control-group check_boxes optional">
<div class="controls">
<label class="checkbox">
<input class="check_boxes optional" id="user_interest_ids_1" name="user[interest_ids][] "
type="checkbox" value="1" />Adventure Sports</label>
<label class="checkbox">
<input class="check_boxes optional" id="user_interest_ids_2" name="user[interest_ids][]"
type="checkbox" value="2" />Arts and Crafts</label>
Probably would go with jQuery to deal with this :