I don''t have Rails installed at the moment, I''d like to check myself, but it''s just a simple curiosity. observe_field fits into replacement tags <%= %>, which caught my attention because as far as I know it''s just javascript observing a field and should not stick anything into HTML. Is <%= merely used as an enabling method, or will there actually be some sort of HTML object there? Also, does the observer have to come after the field it is observing or can I stick them all at the top of the HTML? Thanks. -- 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 -~----------~----~----~----~------~----~------~--~---
Michael Chow wrote:> I don''t have Rails installed at the moment, I''d like to check myself, > but it''s just a simple curiosity.Install Rails, Firefox, & Firebug, and try it.> observe_field fits into replacement tags <%= %>, which caught my > attention because as far as I know it''s just javascript observing a > field and should not stick anything into HTML. Is <%= merely used as an > enabling method, or will there actually be some sort of HTML object > there?When I use a <%= form_remote_for ... %>, and when I run my site in Firefox, point my mouse to the form, and get the "Context Menu" (the "right" mouse button), Firebug has a feature "inspect element". This shows the form in a panel of my browser, like this: <form onsubmit="new Ajax.Request(''/ring/set_attack_mode'', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" method="post" id="attack_form" action="/ring/set_attack_mode"> The <%%> part turned into a big splatch of JavaScript, calling the Prototype.js (or Scriptaculous?) method Ajax.Request. And that hides all the ugly magic required to send the ajax commands to my controller ''ring'', action ''set_attack_mode''. The observe_field stuff must work the same general way - a Rails method, in Ruby, wrapping a Scriptaculous method, in JavaScript.> Also, does the observer have to come after the field it is observing or > can I stick them all at the top of the HTML?Put them near their observers, so they are clear to read. -- Phlip http://www.oreilly.com/catalog/9780596510657/ "Test Driven Ajax (on Rails)" assert_xpath, assert_javascript, & assert_ajax --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I know form_remote_for generates HTML, of course :) That''s implied considering there''s a form to be generated. I was asking specifically about observe_field and observe_form considering they go into a <%= tag yet there''s no apparent HTML that should be generated. I was just looking for a quick answer from someone who already used the helper, I can certainly check myself later, no biggie. -- 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 -~----------~----~----~----~------~----~------~--~---
mboeh-UtljGsy+VVc0aPf6s/0I7w@public.gmane.org
2007-Jul-18 16:21 UTC
Re: observe_field, does this generate HTML?
observe_field and observe_form both generate SCRIPT elements containing that Javascript. On Jul 14, 3:23 pm, Michael Chow <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I know form_remote_for generates HTML, of course :) That''s implied > considering there''s a form to be generated. I was asking specifically > about observe_field and observe_form considering they go into a <%= tag > yet there''s no apparent HTML that should be generated. > > I was just looking for a quick answer from someone who already used the > helper, I can certainly check myself later, no biggie. > > -- > 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 -~----------~----~----~----~------~----~------~--~---