Hi, First, I''m a beginner in : - Prototype - English (I hope it will be understandable) I have a little matter with prototype, with the ajax.updater object in fact. When I use an "object" like Calendar.setup or new AutoComplete in the main document, there is no problem. In next step, I call a new document through ajax.updater. In this document, I call again a new document, always by ajax.updater. And in this second document, if I call Calendar.setup or AutoComlete, Firefox tells me that Calendar is not defined. I use evalScripts: true, but when I call a function which is define in the main document, it works. I think this is a newbee mistake, but I don''t realy understand. Could you help me ? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
No ideas ? 2008/1/17, Mathieu Sachot <mathieu.sachot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > Hi, > > First, I''m a beginner in : > - Prototype > - English (I hope it will be understandable) > > I have a little matter with prototype, with the ajax.updater object in > fact. > > When I use an "object" like Calendar.setup or new AutoComplete in the main > document, there is no problem. In next step, I call a new document through > ajax.updater. In this document, I call again a new document, always by > ajax.updater. And in this second document, if I call Calendar.setup or > AutoComlete, Firefox tells me that Calendar is not defined. I use > evalScripts: true, but when I call a function which is define in the main > document, it works. > > I think this is a newbee mistake, but I don''t realy understand. Could you > help me ? >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
you''ll need to provide some sample links or some sample code... what all javascript files are you using? have you eliminated all other JS files other than prototype and scriptaculous? On Jan 23, 2008 12:26 PM, Mathieu Sachot <mathieu.sachot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> No ideas ? > > 2008/1/17, Mathieu Sachot <mathieu.sachot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > Hi, > > > > First, I''m a beginner in : > > - Prototype > > - English (I hope it will be understandable) > > > > I have a little matter with prototype, with the ajax.updater object in > > fact. > > > > When I use an "object" like Calendar.setup or new AutoComplete in the > > main document, there is no problem. In next step, I call a new document > > through ajax.updater. In this document, I call again a new document, > > always by ajax.updater. And in this second document, if I call > > Calendar.setup or AutoComlete, Firefox tells me that Calendar is not > > defined. I use evalScripts: true, but when I call a function which is define > > in the main document, it works. > > > > I think this is a newbee mistake, but I don''t realy understand. Could > > you help me ? > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You know, I understand that having JS come across in Ajax requests is handy. Obviously I am not bashing the idea of JSON coming across the wire, but a lot of people use <script> tags and evaluate and run scripts that come in asynchronously. Perhaps I am a stickler for structure but I believe that this is a horrible design pattern that leads to massive confusion. If an object inside the request needs calendar functionality, why call it within that "document" request. Instead have an event listener to the Ajax.Updater''s onComplete method and then within the listener function use Caledar.setup to apply to the newly integrated DOM object inside your new "document". On another note I wouldn''t really refer to them as documents, an HTML document starts with <html> if it doesn''t then its really an HTML fragment and should be considered as such. On Jan 23, 1:34 pm, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> you''ll need to provide some sample links or some sample code... > > what all javascript files are you using? have you eliminated all other JS > files other than prototype and scriptaculous? > > On Jan 23, 2008 12:26 PM, Mathieu Sachot <mathieu.sac...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > No ideas ? > > > 2008/1/17, Mathieu Sachot <mathieu.sac...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > Hi, > > > > First, I''m a beginner in : > > > - Prototype > > > - English (I hope it will be understandable) > > > > I have a little matter with prototype, with the ajax.updater object in > > > fact. > > > > When I use an "object" like Calendar.setup or new AutoComplete in the > > > main document, there is no problem. In next step, I call a new document > > > through ajax.updater. In this document, I call again a new document, > > > always by ajax.updater. And in this second document, if I call > > > Calendar.setup or AutoComlete, Firefox tells me that Calendar is not > > > defined. I use evalScripts: true, but when I call a function which is define > > > in the main document, it works. > > > > I think this is a newbee mistake, but I don''t realy understand. Could > > > you help me ?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Matt, +1 I, myself, can barely understand the need for such pattern. On Jan 23, 2:00 pm, Matt Foster <mattfoste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You know, I understand that having JS come across in Ajax requests is > handy. Obviously I am not bashing the idea of JSON coming across the > wire, but a lot of people use <script> tags and evaluate and run > scripts that come in asynchronously. Perhaps I am a stickler for > structure but I believe that this is a horrible design pattern that > leads to massive confusion. If an object inside the request needs > calendar functionality, why call it within that "document" request. > Instead have an event listener to the Ajax.Updater''s onComplete method > and then within the listener function use Caledar.setup to apply to > the newly integrated DOM object inside your new "document". > > On another note I wouldn''t really refer to them as documents, an HTML > document starts with <html> if it doesn''t then its really an HTML > fragment and should be considered as such. > > On Jan 23, 1:34 pm, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > you''ll need to provide some sample links or some sample code... > > > what all javascript files are you using? have you eliminated all other JS > > files other than prototype and scriptaculous? > > > On Jan 23, 2008 12:26 PM, Mathieu Sachot <mathieu.sac...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > No ideas ? > > > > 2008/1/17, Mathieu Sachot <mathieu.sac...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > > Hi, > > > > > First, I''m a beginner in : > > > > - Prototype > > > > - English (I hope it will be understandable) > > > > > I have a little matter with prototype, with the ajax.updater object in > > > > fact. > > > > > When I use an "object" like Calendar.setup or new AutoComplete in the > > > > main document, there is no problem. In next step, I call a new document > > > > through ajax.updater. In this document, I call again a new document, > > > > always by ajax.updater. And in this second document, if I call > > > > Calendar.setup or AutoComlete, Firefox tells me that Calendar is not > > > > defined. I use evalScripts: true, but when I call a function which is define > > > > in the main document, it works. > > > > > I think this is a newbee mistake, but I don''t realy understand. Could > > > > you help me ?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ideally speaking, you are spot on Matt, but in reality I just don''t see that to be a feasible, scalable option. In a large project, such an approach has lead me (I used to be a stickler for such design patterns) down a prickly path of one-off solutions in hundreds of different places in my JavaScript. It''s much easier to manage, at least in my opinion, when it''s all generated from the backend. -justin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks to all for your answers. I finally solve my problem with Matt''s tip, and it works fine. Thank you again, Tohcas 2008/1/24, Justin Perkins <justinperkins-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > > Ideally speaking, you are spot on Matt, but in reality I just don''t > see that to be a feasible, scalable option. In a large project, such > an approach has lead me (I used to be a stickler for such design > patterns) down a prickly path of one-off solutions in hundreds of > different places in my JavaScript. > > It''s much easier to manage, at least in my opinion, when it''s all > generated from the backend. > > -justin > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---