lizardwalker
2007-Feb-20 22:53 UTC
how to create an ajax state-change checkbox with a rails command
Is there a simple set of rails commands that can create a checkbox that sends an ajax submit on each state change of the checkbox? I do not yet know enough about Javascript to write this out without rails'' help. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Colin Mollenhour
2007-Feb-21 01:47 UTC
Re: how to create an ajax state-change checkbox with a rails command
I don''t know anything about Rails, but I do have a Javascript class that''ll do what you want. Maybe someone else here can make a RJS template for it for you? I don''t know how that stuff works... Anyway, you can get it here: http://colin.mollenhour.com/include/prototype/checkbox.js new Ajax.Checkbox(''elementid'', ''page.php'', {params:''action=checkbox''}); It works very similar to Ajax.InPlaceEditor except it has a checkbox. Sorry, no live demo. Colin lizardwalker wrote:> Is there a simple set of rails commands that can create a checkbox > that sends an ajax submit on each state change of the checkbox? I do > not yet know enough about Javascript to write this out without rails'' > help. > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2007-Feb-21 08:04 UTC
Re: how to create an ajax state-change checkbox with a rails command
I believe observe_field is what you need (in addition to creating the checkbox just before in your view). http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000535 -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---