Problem solved. For those interested in the solution, it turns out that
the problem is a fundamental javascript issue, where
onclick="this.form.submit()" completely ignores a form''s
"onsubmit"
event. The solution is to put the entire ajax command in the onclick of
your checkbox.
So it turns out remote_function was the way to go afterall. The trick is
to give the form a DOM element id and then add the :submit parameter to
the remote_function, pointing to the form''s id. Here''s an
example of how
it works:
<%= form_remote_tag :update => "some_div", :url => { :action
=> "save"
}, :html => { :id => "dom_id" } %>
<%= check_box "report", "word", :onclick =>
remote_function(:update =>
"some_div", :url => { :action => "save" }, :submit
=> "dom_id") %>
</form>
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---