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 =>
"remote_function('this.form.

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?

Anyone...?

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

Colin

Hi Colin,

it's this one here:

http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M001653

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

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

Colin

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?

Colin

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,
roark

Tom Ha wrote: