Hi, I had this code: var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : ''de_small'' }).update(obj.innerHTML); which worked fine but now i add this and it breaks my script...it''s hard to explain exactly how it breaks but it involves a draggable object not being droppable anymore var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : ''de_small'' }).update(obj.innerHTML).observe(''click'', deleteThis()); can i not do it like this? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Polgardy
2008-Jul-01 15:13 UTC
Re: cqan i chain this code together in prototype?
I don''t see where the new element is being inserted into the document. Is there code we''re missing? -Fred On Tue, Jul 1, 2008 at 10:08 AM, elduderino <jamesfiltness-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > Hi, > > I had this code: > var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : > ''de_small'' }).update(obj.innerHTML); > > which worked fine but now i add this and it breaks my script...it''s > hard to explain exactly how it breaks but it involves a draggable > object not being droppable anymore > > var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : > ''de_small'' }).update(obj.innerHTML).observe(''click'', deleteThis()); > > can i not do it like this?-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
HI There, Yes the new element is being inserted later ( $ (dropZoneCount.id).appendChild(newCopy);)....that''s all working fine....i only posted the relevant code....the bit of code when it was working and then the same bit of code with the extra code taht breaks the script. Can you see anything wrong with it? On Jul 1, 4:13 pm, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote:> I don''t see where the new element is being inserted into the document. Is > there code we''re missing? > > -Fred > > On Tue, Jul 1, 2008 at 10:08 AM, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > > > > > Hi, > > > I had this code: > > var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : > > ''de_small'' }).update(obj.innerHTML); > > > which worked fine but now i add this and it breaks my script...it''s > > hard to explain exactly how it breaks but it involves a draggable > > object not being droppable anymore > > > var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : > > ''de_small'' }).update(obj.innerHTML).observe(''click'', deleteThis()); > > > can i not do it like this? > > -- > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Looking at this brief snippet I see one potential error, You''re executing your callback, try sending just the reference. On Jul 1, 11:21 am, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> HI There, > > Yes the new element is being inserted later ( $ > (dropZoneCount.id).appendChild(newCopy);)....that''s all working > fine....i only posted the relevant code....the bit of code when it was > working and then the same bit of code with the extra code taht breaks > the script. Can you see anything wrong with it? > > On Jul 1, 4:13 pm, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > > I don''t see where the new element is being inserted into the document. Is > > there code we''re missing? > > > -Fred > > > On Tue, Jul 1, 2008 at 10:08 AM, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > wrote: > > > > Hi, > > > > I had this code: > > > var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : > > > ''de_small'' }).update(obj.innerHTML); > > > > which worked fine but now i add this and it breaks my script...it''s > > > hard to explain exactly how it breaks but it involves a draggable > > > object not being droppable anymore > > > > var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : > > > ''de_small'' }).update(obj.innerHTML).observe(''click'', deleteThis()); > > > > can i not do it like this? > > > -- > > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Polgardy
2008-Jul-01 19:19 UTC
Re: cqan i chain this code together in prototype?
In other words, change: .observe(''click'', deleteThis()); To: .observe(''click'', deleteThis); You''re passing deleteThis() as the value of your callback, which isn''t a function, but the return value of calling it. -Fred On Jul 1, 2008, at 2:09 PM, Matt Foster wrote:> > Looking at this brief snippet I see one potential error, You''re > executing your callback, try sending just the reference. > > > > > On Jul 1, 11:21 am, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >>>> var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : >>>> ''de_small'' }).update(obj.innerHTML).observe(''click'', deleteThis());--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yes taht''s it....why the hell didn''t it try that! Thanks On Jul 1, 8:19 pm, Frederick Polgardy <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote:> In other words, change: > > .observe(''click'', deleteThis()); > > To: > > .observe(''click'', deleteThis); > > You''re passing deleteThis() as the value of your callback, which isn''t > a function, but the return value of calling it. > > -Fred > > On Jul 1, 2008, at 2:09 PM, Matt Foster wrote: > > > > > Looking at this brief snippet I see one potential error, You''re > > executing your callback, try sending just the reference. > > > On Jul 1, 11:21 am, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > >>>> var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : > >>>> ''de_small'' }).update(obj.innerHTML).observe(''click'', deleteThis());--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ah What about in the event that i need to feed a parameter to the function?? like: .observe(''click'', deleteThis(param)); I wouldn''t mind just running the funcion from here: var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : ''de_small'' }).update(obj.innerHTML).observe(''click'', function{(...)}; (so just have the function code just after click...like above) ...but i don''t know if you can do it/get the syntax right On Jul 2, 12:15 pm, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Yes taht''s it....why the hell didn''t it try that! > > Thanks > > On Jul 1, 8:19 pm, Frederick Polgardy <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > > In other words, change: > > > .observe(''click'', deleteThis()); > > > To: > > > .observe(''click'', deleteThis); > > > You''re passing deleteThis() as the value of your callback, which isn''t > > a function, but the return value of calling it. > > > -Fred > > > On Jul 1, 2008, at 2:09 PM, Matt Foster wrote: > > > > Looking at this brief snippet I see one potential error, You''re > > > executing your callback, try sending just the reference. > > > > On Jul 1, 11:21 am, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > >>>> var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : > > >>>> ''de_small'' }).update(obj.innerHTML).observe(''click'', deleteThis());--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Just wrap in another function: .observe(''click'', function(){ deleteThis(param) }); -- kangax On Jul 2, 11:19 am, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Ah What about in the event that i need to feed a parameter to the > function?? > like: .observe(''click'', deleteThis(param)); > > I wouldn''t mind just running the funcion from here: > > var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : > ''de_small'' }).update(obj.innerHTML).observe(''click'', function{(...)}; > > (so just have the function code just after click...like above) ...but > i don''t know if you can do it/get the syntax right > > On Jul 2, 12:15 pm, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > Yes taht''s it....why the hell didn''t it try that! > > > Thanks > > > On Jul 1, 8:19 pm, Frederick Polgardy <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > > > In other words, change: > > > > .observe(''click'', deleteThis()); > > > > To: > > > > .observe(''click'', deleteThis); > > > > You''re passing deleteThis() as the value of your callback, which isn''t > > > a function, but the return value of calling it. > > > > -Fred > > > > On Jul 1, 2008, at 2:09 PM, Matt Foster wrote: > > > > > Looking at this brief snippet I see one potential error, You''re > > > > executing your callback, try sending just the reference. > > > > > On Jul 1, 11:21 am, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > >>>> var newCopy = new Element(''div'', { ''id'' : obj.id, ''class'' : > > > >>>> ''de_small'' }).update(obj.innerHTML).observe(''click'', deleteThis());--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Polgardy
2008-Jul-02 15:54 UTC
Re: cqan i chain this code together in prototype?
Or: .observe(''click'', deleteThis.curry(param)); -Fred On Jul 2, 2008, at 10:46 AM, kangax wrote:> > Just wrap in another function: > > .observe(''click'', function(){ deleteThis(param) }); > > -- kangax-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Sure, if performance is not in question : ) -- kangax On Jul 2, 11:54 am, Frederick Polgardy <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote:> Or: > > .observe(''click'', deleteThis.curry(param)); > > -Fred > > On Jul 2, 2008, at 10:46 AM, kangax wrote: > > > > > Just wrap in another function: > > > .observe(''click'', function(){ deleteThis(param) }); > > > -- kangax > > -- > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
OK, excellent didn''t know you could do that! On Jul 2, 5:39 pm, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Sure, if performance is not in question : ) > > -- kangax > > On Jul 2, 11:54 am, Frederick Polgardy <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote: > > > Or: > > > .observe(''click'', deleteThis.curry(param)); > > > -Fred > > > On Jul 2, 2008, at 10:46 AM, kangax wrote: > > > > Just wrap in another function: > > > > .observe(''click'', function(){ deleteThis(param) }); > > > > -- kangax > > > -- > > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---