I need to have a checkbox which ajax-submits a form.
The following code throws an error “index 112009 out of string”. What’s
wrong here?
<% form_remote_tag :url => { whatever_url } do -%>
<%= check_box_tag 'whatever', nil, whatever, { :onclick => "#{remote_function('this.form.submit();')}" } %>
<% end -%>
Thanks for any help with this!
Tom
Seems you are abusing the
remote_functionhelper. Its purpose is to generate the same javascript as is generated withlink_to_remoteet al., like, to update a div with the result of an AJAX call. In your case you need a simple thing likeNote the
onsubmit, notsubmit. This is because the code you need to submit the form via AJAX is present in theonsubmitattribute of the form.