hi all, i am using script aculo us autocompleter : aa = new Ajax.Autocompleter("txtNe","hint","business/ AutoComlateEmlak.aspx",{minChars: 5}); delete aa; alert(aa);//true but auto completer still running. can i how to delete, dispose or drop them. thanks a lot sorry my english onder --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Onder Arslan a écrit :> but auto completer still running. > can i how to delete, dispose or drop them. > thanks a lot sorry my englishI''m sorry to say Autocompleter.Base and its subclasses lack a destroy/dispose method, which you can find on other Scripty features. Technically, auto-completion plays with two events on your element: blur and keydown. If you don''t have other registered handlers for these, you could trick the system into disabling auto-completion by doing this (uses Prototype 1.6, hence assumes script.aculo.us 1.8): $(''yourElementId'').stopObserving(''blur'').stopObserving(''keydown''); If your element originally allowed browser-based completion, you might also want to add to this chaining: .setAttribute(''autocomplete'', ''on''); Then, you can explicitely delete the autocompleter object if you want to (otherwise the garbage collector will do that for you later on). ''HTH -- Christophe Porteneuve aka TDD 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 -~----------~----~----~----~------~----~------~--~---
thanks your answer but i can not use $(''yourElementId'').stopObserving(''blur'').stopObserving(''keydown''); because i want to use autocompleter, i want to usage like his : if($(''cbox'').value == true) new Ajax.Autocompleter("txt","hint","data.aspx",{minChars: 5}); else new Ajax.Autocompleter("txt","hint","other_data.aspx",{minChars: 5}); and cbox value change will dynamically when web site using. i want to use sometimes data.aspx or other_data.aspx for completion data thanks a lot, sorry my english i hope i could explain my problem onder 2007/12/19, Christophe Porteneuve <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org>:> > > Onder Arslan a écrit : > > but auto completer still running. > > can i how to delete, dispose or drop them. > > thanks a lot sorry my english > > I''m sorry to say Autocompleter.Base and its subclasses lack a > destroy/dispose method, which you can find on other Scripty features. > > Technically, auto-completion plays with two events on your element: blur > and keydown. If you don''t have other registered handlers for these, you > could trick the system into disabling auto-completion by doing this > (uses Prototype 1.6, hence assumes script.aculo.us 1.8): > > $(''yourElementId'').stopObserving(''blur'').stopObserving(''keydown''); > > If your element originally allowed browser-based completion, you might > also want to add to this chaining: > > .setAttribute(''autocomplete'', ''on''); > > Then, you can explicitely delete the autocompleter object if you want to > (otherwise the garbage collector will do that for you later on). > > ''HTH > > -- > Christophe Porteneuve aka TDD > 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 -~----------~----~----~----~------~----~------~--~---
Hey Onder, Onder Arslan a écrit :> because i want to use autocompleter, i want to usage like his : > > if($(''cbox'').value == true) > new Ajax.Autocompleter("txt","hint","data.aspx",{minChars: 5}); > else > new Ajax.Autocompleter("txt","hint","other_data.aspx",{minChars: 5}); > > and cbox value change will dynamically when web site using. > i want to use sometimes data.aspx or other_data.aspx for completion dataOK, but my system still works as long as you don''t use keydown/blur events on $(''txt'') otherwise. Imagine this: function defineAutocompleter(target_url) { var field = $(''txt''); if (field._ac) { $(''txt'').stopObserving(''blur'').stopObserving(''keydown''); delete field._ac; } field._ac = new Ajax.Autocompleter(field, ''hint'', target_url, { minChars: 5 }); } // defineAutocompleter new Field.EventObserver(''cbox'', function(cbox, checked) { defineAutocompleter(checked ? ''data.aspx'' : ''other_data.aspx''); }); This should cut it nicely. Untested, but most likely to work. Notice how using Field.EventObserver here spares you the need to react manually to your checkbox being checked/unchecked. If you need more flexibility when calling defineAutocompleter (e.g. specify element/completionZone IDs or extra options, just add the arguments to it. ''HTH -- Christophe Porteneuve aka TDD 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 -~----------~----~----~----~------~----~------~--~---