The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

kurinosuke (156) [Avatar] Offline
#1
The lab-autocompleter-local.jsp does not seem to be working well in Firefox.
I have the following entry list :
sadf
sdfg
sdaf
gfdf

When I type "s", the three top entries are displayed, but then if I type "d", "sdfg" and "sdaf" are briefly displayed, then the list disappears. It works fine under IE6.

PS1 : It sometimes works fine after refreshing the page, but then starts to act not as expected when creating a new Autocomplete component.

PS2 : Another problem which might be related. It seems to be working fine the first time I create an Autocomplete. For example, one Autocomplete with minChars set to 3. The list will be correctly displayed at the 3rd char. Then I set minChars to 4, and create a new Autocomplete, but the list still appears at the third char. (same for IE6)
bear.bibeault (675) [Avatar] Offline
#2
Re: About lab-autocompleter-local.jsp
Interesting. I was not able to reproduce this problem in Firefox 2.0.0.3.

What version are you using?
kurinosuke (156) [Avatar] Offline
#3
Re: About lab-autocompleter-local.jsp
I'm also using 2.0.0.3. I guess it worked the first time I generated the component, but it became to give strange results when I create a new component without refreshing the page. As if event handlers were still floating somewhere.

I can't reproduce it clearly. It seems to happen when I set the minChars. Setting it once to 2, and showing the list. Then setting it to 3, creating a new Autocomplete, and showing the list. Then it starts to behave strangely.
davecrane (149) [Avatar] Offline
#4
Re: About lab-autocompleter-local.jsp
Sounds like that's the problem! The AutoCompleter (and just about every behaviour in P & S) uses the W3C event model, which allows multiple event listeners on an element. I'm guessing it doesn't tidy up after itself because, outside of a lab page like this one, there are few use cases where you'd want to recreate an Autocompleter multiple times.

I know the Sortable, for example, will tidy up after itself, because there's a common need to do so after adding new elements to a sortable list, but I don't think the Autocompleter does.

Well done for spotting this!

Dave
bear.bibeault (675) [Avatar] Offline
#5
Re: About lab-autocompleter-local.jsp
Yes, the Lab pages, while useful as demos, don't really reflect how things would be used in the real world.
kurinosuke (156) [Avatar] Offline
#6
Re: About lab-autocompleter-local.jsp
Thanks for your replies. The Lab pages are nonetheless very useful to try the components.