Hello, I have created a ticket for an enhancement of the autocompleter to show the options immediately when the field gets focus. Right now at least one character must be typed for autocomplete to kick in. http://dev.rubyonrails.org/ticket/5435 I have also made some code changes directly in the script Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this)); Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this)); Event.observe(this.element, "focus", this.onKeyPress.bindAsEventListener(this)); The last line is what I have added. And then I have commented some code: onObserverEvent: function() { this.changed = false; // if(this.getToken().length>=this.options.minChars) { this.startIndicator(); this.getUpdatedChoices(); // } else { // this.active = false; // this.hide(); // } }, These changes are not in the best tradition of programming, but I am a javascript newbie and as a preliminary step I just wanted to get things working. The problem with these changes is that in an empty field it is not possible to select an item from the drop down by clicking on it. (using arrows and tabs work fine). Please help me implement this feature. What am I doing wrong or missing in my implementation, which causes me to face the above problem? Thanks. -- Surendra Singhi http://ssinghi.kreeti.com, http://www.kreeti.com Read my blog at: http://cuttingtheredtape.blogspot.com/ ,---- | Great wits are sure to madness near allied, | And thin partitions do their bounds divide. | | (John Dryden, Absalom and Achitophel, 1681) `----
Surendra Singhi <efuzzyone-VsqqI1RANlHk1uMJSBkQmQ@public.gmane.org> writes:> Hello, > I have created a ticket for an enhancement of the autocompleter to show the > options immediately when the field gets focus. Right now at least one > character must be typed for autocomplete to kick in. > > http://dev.rubyonrails.org/ticket/5435 > > I have also made some code changes directly in the script > > Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this)); > Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this)); > Event.observe(this.element, "focus", this.onKeyPress.bindAsEventListener(this)); > > The last line is what I have added. > > And then I have commented some code: > > onObserverEvent: function() { > this.changed = false; > // if(this.getToken().length>=this.options.minChars) { > this.startIndicator(); > this.getUpdatedChoices(); > // } else { > // this.active = false; > // this.hide(); > // } > }, > > These changes are not in the best tradition of programming, but I am a > javascript newbie and as a preliminary step I just wanted to get things > working.The above code works.> > The problem with these changes is that in an empty field it is not possible to > select an item from the drop down by clicking on it. (using arrows and tabs > work fine). >There was some problem with my javascript code somewhere else, which was causing this problem. Regards. -- Surendra Singhi http://ssinghi.kreeti.com, http://www.kreeti.com Read my blog at: http://cuttingtheredtape.blogspot.com/ ,---- | Great wits are sure to madness near allied, | And thin partitions do their bounds divide. | | (John Dryden, Absalom and Achitophel, 1681) `----
Surendra Singhi <efuzzyone-VsqqI1RANlHk1uMJSBkQmQ@public.gmane.org> writes:> Surendra Singhi <efuzzyone-VsqqI1RANlHk1uMJSBkQmQ@public.gmane.org> writes: > >> Hello, >> I have created a ticket for an enhancement of the autocompleter to show the >> options immediately when the field gets focus. Right now at least one >> character must be typed for autocomplete to kick in. >> >> http://dev.rubyonrails.org/ticket/5435 >> >> I have also made some code changes directly in the script >> >> Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this)); >> Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this)); >> Event.observe(this.element, "focus", this.onKeyPress.bindAsEventListener(this)); >> >> The last line is what I have added. >> >> And then I have commented some code: >> >> onObserverEvent: function() { >> this.changed = false; >> // if(this.getToken().length>=this.options.minChars) { >> this.startIndicator(); >> this.getUpdatedChoices(); >> // } else { >> // this.active = false; >> // this.hide(); >> // } >> }, >> >> These changes are not in the best tradition of programming, but I am a >> javascript newbie and as a preliminary step I just wanted to get things >> working. > > The above code works. >> >> The problem with these changes is that in an empty field it is not possible to >> select an item from the drop down by clicking on it. (using arrows and tabs >> work fine). >> > There was some problem with my javascript code somewhere else, which was > causing this problem. >Stripe-man <remsikt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:>May i see your sample code ? (complete working) >The complete code is available at www.megasocial.com. It is embedded in the page. I have directly modified controls.js. Though still not sure, whether I did it the best way, but I am feeling good that I was able to look into such high quality Javascript code, and understand and modify it :) Cheers. -- Surendra Singhi http://ssinghi.kreeti.com, http://www.kreeti.com Read my blog at: http://cuttingtheredtape.blogspot.com/ ,---- | "O thou my friend! The prosperity of Crime is like unto the lightning, | whose traitorous brilliancies embellish the atmosphere but for an | instant, in order to hurl into death''s very depths the luckless one | they have dazzled." -- Marquis de Sade `----