Here is the table:
<%= form_tag '', :id => "costs" do %>
<table class="table table-bordered" id="service_cost">
<% @services.each do |service| %>
<tbody>
<tr>
<td><%= check_box_tag :open_service, {}, false, :class => 'checkable' %></td>
<td><%= service.phone %></td>
<td><%= service.internet %></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><%= service.house_keeping %> </td>
<td>0.0 </td>
<td><%= service.laundry %></td>
<td><%= text_field_tag "service_cost", service.total, :class => "input-small" %></td>
</tr>
<% end %>
when the form gets submitted, the javascript gets into action:
$("#costs").submit(function(){
formData=$("#costs").serializeArray();
processFormData(formData)
return false;
});
This ensures form submission on selecting the checkbox:
$('.checkable').live('change', function() {
$(this).parents('form:first').submit();
});
But, what I am looking for is adding or removing a cell value based on checkbox selection/de-selection and submitting it, kindly suggest a way to do it.