Search code examples
ruby-on-railscheckboxpartialrjs

reload partial after clic a checkbox


I find a way to submit information after clic on a checkbox.

<% remote_form_for @object do |f|  %>
<%= f.check_box :state, :label => @object.state, :onchange =>
'this.form.onsubmit()'%> <%end%>

I would like to update the view… but no chance with the helpers. Any idea how to make it active ?

page[:patentencart].replace_html :partial => 'partial'

Solution

  • Rails 3 response :

    <%= form_for @object, :remote => true do |f|  %>
    <%= f.check_box :state, :label => @object.state, :onchange => 'this.form.submit()'%>
    <%end%>
    

    Change 'this.form.onsubmit()' in 'this.form.submit()'