I''m sure there is an easy way to do this, but it is one of those things that is incredibly difficult to search for. How can I disable an ''Ajax.Autocompleter'' element from working ''on the fly''? I have a page where I''m using two (I know it''s crazy) Ajax.Autocompleter elements and once one of them has got a result I want the other field to just behave as a normal text input. There may even be a defined method to do this but I don''t know what it is. Any help? Thanks in advance, --mobrien118 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mobrien118
2006-Nov-30 18:25 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
Oh, I forgot, I would like to be able to re-enable it without a page load as well. Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Andrew Kaspick
2006-Nov-30 18:37 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
Without actually trying anything myself, but just taking a guess here. Could you just stop observing the text field using the stopObserving method and then when you want to use the text field as an autocomplete again, just re-observe the original events with the observe method? On 11/30/06, mobrien118 <mobrien118-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Oh, I forgot, I would like to be able to re-enable it without a page > load as well. > > Thanks! > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mobrien118
2006-Nov-30 19:18 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
I found that method called in the code like ''Event.stopObserving(this.element, ''click'', this.onclickListener);''. Unfortunately, I am not advanced enough to know how to do this myself. My Ajax.Autocompleter is called ''DESCRIPTIVE_NAME'' and is created as such: new Ajax.Autocompleter("DESCRIPTIVE_NAME", "autosuggest2", "DCO_Manage_Project.cfc", {parameters:''method=getHTMLByDesc'', afterUpdateElement:getInfo, indicator:''JSMX_loading'',frequency:0.2}); Can you help me any more? I will keep researching in the mean time. Thanks for the help so far in pointing me in the right direction. --mobrien118 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Andrew Kaspick
2006-Nov-30 19:59 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
Again, I''m not actually trying any of this out, but something like this... var ac = new Ajax.Autocompleter("DESCRIPTIVE_NAME", "autosuggest2", ... // stop observing Event.stopObserving(ac.element, ''keypress'', ac.onKeyPress) // start observing again Event.observe(ac.element, ''keypress'', ac.onKeyPress.bindAsEventListener(ac)) Again, no idea if this works at all, or if it''s even in a step in the right direction. Play with it and see what you get. :) Andrew On 11/30/06, mobrien118 <mobrien118-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I found that method called in the code like > ''Event.stopObserving(this.element, ''click'', this.onclickListener);''. > Unfortunately, I am not advanced enough to know how to do this myself. > My Ajax.Autocompleter is called ''DESCRIPTIVE_NAME'' and is created as > such: > > new Ajax.Autocompleter("DESCRIPTIVE_NAME", "autosuggest2", > "DCO_Manage_Project.cfc", {parameters:''method=getHTMLByDesc'', > afterUpdateElement:getInfo, indicator:''JSMX_loading'',frequency:0.2}); > > Can you help me any more? I will keep researching in the mean time. > Thanks for the help so far in pointing me in the right direction. > > --mobrien118 > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mobrien118
2006-Dec-01 21:11 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
OK, I tried adding these commands, and they are running but not doing anything that I can tell: Event.stopObserving(document.getElementById(''DESCRIPTIVE_NAME'').element, ''click'', document.getElementById(''DESCRIPTIVE_NAME'').onclickListener); Event.stopObserving(document.getElementById(''DESCRIPTIVE_NAME'').element, ''mouseover'', document.getElementById(''DESCRIPTIVE_NAME'').mouseoverListener); Event.stopObserving(document.getElementById(''DESCRIPTIVE_NAME'').element, ''mouseout'', document.getElementById(''DESCRIPTIVE_NAME'').mouseoutListener); There has to be a way to do this! Any help? --mobrien118 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mobrien118
2006-Dec-01 21:18 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
Oh wait! I am actually getting an error "element has no properties" on line 2005 of Prototype.js ("if (element.removeEventListener) {") when I make these calls. Am I calling them correctly? (correct parameters?) Thanks again, --mobrien118 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mobrien118
2006-Dec-02 19:52 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
Please, anyone? Maybe I can reassign the onkeypress and onclick to some other action (like an empty function) but then how do I ''turn it on'' again? I''m really strugglin'' here. Thanks, --mobrien118 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mobrien118
2006-Dec-04 05:14 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
Okay, a little off of the topic I''m haing another strange problem with this same page. Here''s what I''m trying to do: I have 2 autocomplete fields, both drawing from the same data. The first contains the primary key for the database, the second contains a description field. When the first field is filled by a valid key (by clicking ''enter'' or moueclick on an element from the autocomplete dropdown) it is disabled using JavaScript (setting readOnly=true). This keeps it from being edited etc. The second field also uses an autocomplete, but searches by the description. Since it is not a unique key, when someone selects an item from this autocomplete dropdown it gets the primary key, then moves the value to the primary field and gets the info (thus doing the same thing as if the user put the primary key in the primary key field and filling in the rest of the info). The new problem I''m having is that pressing ''enter'' on the SECOND autocomplete field closes the autocomplete dropdown (as if I had selected a value) but doesn''t actually insert the value. If I click on a selection with the mouse it works, though. Why would the mouse-click work but not the keypress? This is, of course, on top of my original problem of not being able to disable the second field without making it readOnly, which I can''t do because it must be editable. This is tough, and I''m starting to believe impossible. :-( --mobrien118 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mobrien118
2006-Dec-19 21:57 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
I am desperate to find the solution to this problem! So, I will paypal whoever can figure this out $1 and post my working solution here AND I will never post about this problem again. Anyone? --mobrien118 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Tom Gregory
2006-Dec-19 22:14 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
If all else fails, cheat. A kuldgey workaround: make two elements, one with the auto-complete, the other without. Switch between them in such a way that the user can''t tell. It''s not a good answer, but maybe it''ll lead you to a better one. TAG On Dec 19, 2006, at 2:57 PM, mobrien118 wrote:> > I am desperate to find the solution to this problem! > > So, I will paypal whoever can figure this out $1 and post my working > solution here AND I will never post about this problem again. > > Anyone? > > --mobrien118 > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ian Tyndall
2006-Dec-20 00:50 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
If you are just using one Autocompleter on the page, you can disable it by using something like this: <input type="radio" onclick="Event.unloadCache();" /> I know its not the best answer, but it does disable the autocompleter. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Arkadiusz MĹ‚ynarczyk
2006-Dec-22 01:11 UTC
Re: Disable autocomplete (Ajax.Autocompleter) on the fly.
My sugestion <input type="text" class="autoComplete" id="text1" value=""/> <div id="choice1" class="autocomplete"></div> <input type="text" class="autoComplete" id="text2" value=""/> <div id="choice2" class="autocomplete"></div> <input type="text" class="autoComplete" id="text3" value=""/> <div id="choice3" class="autocomplete"></div> And Javascript Part var AutoCompleters = new Array(); AutoCompleters[AutoCompleters.length]=new Ajax.Autocompleter("text1", "choice1", "/url/on/server", {}); AutoCompleters[AutoCompleters.length]=new Ajax.Autocompleter("text2", "choice2", "/url/on/server", {}); ... and after that you can create function function disable() { AutoCompleter.each(function(item) { Event.stopObserving(item.element, "keypress", item.onKeyPress.bindAsEventListener(this)); }); } function enable() { AutoCompleter.each(function(item) { Event.stopObserving(item.element, "keypress", item.onKeyPress.bindAsEventListener(item)); }); } Something like that i think. I write from my head, so i don't know if it works. 2006/11/30, mobrien118 <mobrien118@gmail.com>:> > I'm sure there is an easy way to do this, but it is one of those things > that is incredibly difficult to search for. > > How can I disable an 'Ajax.Autocompleter' element from working 'on the > fly'? I have a page where I'm using two (I know it's crazy) > Ajax.Autocompleter elements and once one of them has got a result I > want the other field to just behave as a normal text input. > > There may even be a defined method to do this but I don't know what it > is. > > Any help? > > Thanks in advance, > > --mobrien118 > > > > >-- Pozdrawiam Arkadiusz M ynarczyk --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---