Loïc
2006-Nov-09 16:21 UTC
Script.aculo.us : how to use updateElement function of Ajax.Autocompleter ?
Hello, i''ve tried this : new Ajax.Autocompleter("nom", "autocomplete_choices", "getLogin.php", { minChars: 2, indicator: ''indicator1'', updateElement : getLogin}); ----- <script > function getLogin(valeur){ $("debug").innerHTML=valeur; } </script> The list is well populating but when I select an item, to run the getLogin function here is what i get in my debug div : [object] What am i doing wrong ? Thanx for your help --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2006-Nov-09 18:42 UTC
Re: Script.aculo.us : how to use updateElement function of Ajax.Autocompleter ?
Hey Loïc, Loïc a écrit :> Hello, > i''ve tried this : > > new Ajax.Autocompleter("nom", "autocomplete_choices", "getLogin.php", { > minChars: 2, indicator: ''indicator1'', updateElement : getLogin});OK, first, you do know that redefining updateElement will *replace* regular option tokenizing and addition with your own, right? Is this really what you''re trying to do? The argument that is passed is the HTMLOptionElement representing the selected item. The default updateElement behavior performs all the processing described in the wiki: filtering based either on the select option or by excluding "internal"-class''d elements, then text concatenation, then either value addition (defined ''token'' option) or value replacement. And of course, calling the callback I mention in the next paragraph. That''s a LOT to redefine properly, don''t you think? If you''re just looking for a callback function to be called once the selection was properly performed and has appeared in your autocompleted field, use the afterUpdateElement callback. It takes two arguments: the autocompleted field and the HTMLOptionElement representing the selected item. -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Loïc
2006-Nov-10 07:52 UTC
Re: Script.aculo.us : how to use updateElement function of Ajax.Autocompleter ?
Merci Christophe! I guess i''ve missed some info in the wiki OK i think i will use afterUpdateElement and benefit the allready done job ! ;-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---