I have a form consisting of checkboxes which is filtering records on an index page, how can I make the checkboxes in the form keep their checked state once the form is submitted and the page is reloaded?
I'm already using jQuery-UI to make the checkboxes look better. Im super new to any kind of programming and having less luck with javascript.
index.html.erb
<script>
$(function() {
$(".areas").buttonset();
});
$(function() {
$( "button, input:submit, a", ".filter_form_button" ).button();
$( "a", ".form_filter_button" ).click(function() { return false; });
});
</script>
<div class="filter_options_container">
<%= form_tag '', :method => :get, :id => 'filter_form' do %>
<fieldset class="filter_form_fieldset areas">
<% Area.all.each do |a| %>
<p class="area_check"><%= check_box_tag 'areas[]', a.id, false, :id => "area-#{a.id}" %>
<label for="area-<%= a.id %>"><p1><%= a.name %></p1></label></p>
<% end %>
</fieldset>
<div class="filter_form_button">
<p2><input type="submit" value="Filter"/></p2>
</div>
<% end %>
</div>
Any help with this is much appreciated!