Hi,
just run submit()
$(''input#item_status'').live ''click'', ->
$(this).parent(''form'').submit()
param (e) is not needed, even in coffee :)
tom
On Jul 19, 2011, at 21:31 , Linus Pettersson wrote:
> Hi!
>
> I have a form with only a checkbox. When the user clicks this checkbox I
want to submit the form through AJAX. It''s like a TODO-list where you
can mark the item as done by ticking a box.
>
> So, how can I do this? :) I''m using Rails 3.1.
>
> I guess there is no native function to achieve this. So far I have this:
>
> My form in the view:
>
> <%= form_for [@list, item], :remote => true do |f| %>
> <%= f.check_box :status %>
> <% end %>
>
> Then in my javascript file I guess I need to do something like (coffee):
> $(''input#item_status'').live ''click'',
(e) ->
> form = $(this).parent(''form'')
> /* SUBMIT FORM HERE! */
>
>
> Any ideas?
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
> To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/OZC_YqiskkQJ.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
--
==============================================================================Tomas
Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz
==============================================================================
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.