I'm having a problem getting the rjs sent to a client from a
controller to execute when I submit the form with an onclick event in
a checkbox instead of using a submit tag.  The returned js is rendered
as text.

I create a form with form_remote_tag <% form_remote_tag :html =>
{:action => 'add_to_filter', :name => "frm_categories"} do %> I've got
a bunch of checkboxes in the form, and I add a manually add an onclick
event to each one that submits the form.

When one of the check boxes is clicked, the form submits, and my
controller processes everything and sends back the javascript, but
it's not being executed by the client, it's just being displayed as
text.

The returned javascript is executed perfectly when I use a submit tag
created by the submit_tag helper or manually (even when I manually
create a submit tag with a name other than 'commit', which is the
default name that submit_tag generates).   Why would using the onclick
or onchange events be any different?  What magic does the submit tag
do that an onclick = "document.frm_categories.submit()" wouldn't do?

I guess if I can't get this to work, I can create field observers for
each of my twenty checkboxes or a form observer?  Would that be a
better route anyway?

Thanks for any advice!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to