I want to write a function like this: function Load_AutoComplete($sFunc){ new Ajax.Autocompleter("autocomplete_name", "autocomplete_name_choices", "library/common.php?cmdCommand=PatientLookup", {afterUpdateElement: $sFunc}); } Load_AutoComplete(''MyFunc''); As you probably know, this doesn''t work. Can someone tell me how to pass the afterUpdateElement as a parameter? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Keith
2007-Jul-09 23:24 UTC
Re: AutoComplete - pass variable function to afterUpdateElement
Well, I figured it out. function Load_AutoComplete($sFunc){ new Ajax.Autocompleter("autocomplete_name", "autocomplete_name_choices", "library/common.php?cmdCommand=PatientLookup", {afterUpdateElement: eval($sFunc)}); } On Jul 9, 6:17 pm, Keith <keithda...-ZSqciin8Y8iqm2yrvHTro1aTQe2KTcn/@public.gmane.org> wrote:> I want to write a function like this: > > function Load_AutoComplete($sFunc){ > > new Ajax.Autocompleter("autocomplete_name", > "autocomplete_name_choices", > "library/common.php?cmdCommand=PatientLookup", > {afterUpdateElement: $sFunc}); > > } > > Load_AutoComplete(''MyFunc''); > > As you probably know, this doesn''t work. Can someone tell me how to > pass the afterUpdateElement as a parameter?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Xavier Noria
2007-Jul-09 23:27 UTC
Re: AutoComplete - pass variable function to afterUpdateElement
El Jul 10, 2007, a las 1:24 AM, Keith escribió:> Well, I figured it out.The hook needs a function. There, you are passing the function''s name as a string and eval''ing that to get to the function. It is shorter to pass the function directly: oad_AutoComplete(MyFunc); // no quotes -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Keith
2007-Jul-09 23:33 UTC
Re: AutoComplete - pass variable function to afterUpdateElement
Ah, ok. On Jul 9, 6:27 pm, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote:> El Jul 10, 2007, a las 1:24 AM, Keith escribió: > > > Well, I figured it out. > > The hook needs a function. There, you are passing the function''s name > as a string and eval''ing that to get to the function. It is shorter > to pass the function directly: > > oad_AutoComplete(MyFunc); // no quotes > > -- fxn--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---