Ajax-submit form on "check box onclick ": why this error?

Hi there,

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?

I think…
Dont use #{…}

<%= check_box_tag ‘whatever’, nil, whatever, { :onclick =>

submit();’)", :disabled => false } %>

But I dont because i never try it…
keep trying

Thanks for your answer. Unfortunately, if I try...

  :onclick => "remote_function('this.form.submit();')"

...then I get an error (by Firebug): "remote_function is not defined"

Any other ideas?


What method called remote_function are you trying to call? Can you
point me to the docs for it?


Hi Colin,

it's this one here:


(in order to ajax-submit a form using form_remote_tag, see code

Your code does not seem to be much like the example given, either in
the way it is invoked or in the parameter.


Any idea how the code would have to be, in order to achieve my goal?
(see 1st post)

No, sorry, I have never done this. Anyone else?


Hi Tom,

I came across your post looking for a solution myself. This is what's
working for me:

<% form_remote_tag :url => { whatever_url } do -%>
<%= check_box_tag 'whatever', nil, whatever, { :onclick =>
"this.form.submit();", :disabled => false } %>
<% end -%>

Hope that helps, Cheers,

Tom Ha wrote: