Bontina Chen
2007-Feb-07 14:18 UTC
Implemention of "Click on an icon and show a hidden div"
I checked the prototypehelper and find the method show ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ show(*ids) Shows hidden DOM elements with the given ids. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ but I ''m not sure how to integrate these. Should I have a function and a corresponding rjs to do this? or I can just do it in the original rhtml? THX -- 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 -~----------~----~----~----~------~----~------~--~---
Bill Siggelkow
2007-Feb-07 14:34 UTC
Re: Implemention of "Click on an icon and show a hidden div"
You can use the PrototypeHelper functions straight from your web page (e.g. from an onclick event handler) or you can make call Prototype functions directly.... it is just a JavaScript library, after all. For complete details on using Prototype directly check out http:// www.prototypejs.org. RJS comes into play, for example, when the request needs to go through the server from an AJAX call. -Bill On Feb 7, 9:18 am, Bontina Chen <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I checked the prototypehelper and find the method show > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > show(*ids) > > Shows hidden DOM elements with the given ids. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > but I ''m not sure how to integrate these. > > Should I have a function and a corresponding rjs to do this? > > or I can just do it in the original rhtml? > > THX > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
Bontina Chen
2007-Feb-07 14:58 UTC
Re: Implemention of "Click on an icon and show a hidden div"
Bill Siggelkow wrote:> You can use the PrototypeHelper functions straight from your web page > (e.g. from an onclick event handler) or you can make call Prototype > functions directly.... it is just a JavaScript library, after all. For > complete details on using Prototype directly check out http:// > www.prototypejs.org. RJS comes into play, for example, when the > request needs to go through the server from an AJAX call. > > -Bill > > On Feb 7, 9:18 am, Bontina Chen <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>I''m testing <div id="foo" style="display : none;">foo</div> <a href="#" onclick="Element.show(''foo''); return false;">show foo</a> but the foo just won''t show up. -- 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 -~----------~----~----~----~------~----~------~--~---
Kevin Skoglund
2007-Feb-07 15:36 UTC
Re: Implemention of "Click on an icon and show a hidden div"
Try this: <%= link_to(''show foo'', ''#'', :onclick => "Element.show(''foo''); return false;") %> And make sure the page is loading the Prototype javascript in the header. HTH, Kevin Skoglund --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bill Siggelkow
2007-Feb-07 15:52 UTC
Re: Implemention of "Click on an icon and show a hidden div"
Using Firefox with the Firebug extension can really help debug these kind of problems. On Feb 7, 9:58 am, Bontina Chen <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Bill Siggelkow wrote: > > You can use the PrototypeHelper functions straight from your web page > > (e.g. from an onclick event handler) or you can make call Prototype > > functions directly.... it is just a JavaScript library, after all. For > > complete details on using Prototype directly check out http:// > >www.prototypejs.org. RJS comes into play, for example, when the > > request needs to go through the server from an AJAX call. > > > -Bill > > > On Feb 7, 9:18 am, Bontina Chen <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > I''m testing > <div id="foo" style="display : none;">foo</div> > <a href="#" onclick="Element.show(''foo''); return false;">show foo</a> > > but the foo just won''t show up. > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---