How to implement multiple cascade autocomplete (5.1)

How to implement multiple cascade autocomplete (5.1)

For all those of you fighting autocomplete in 5.1... ;)

Can you please help me understand what's wrong with the attached sample?
My purpose is to get results from the 2nd combobox with the given input on the 1st one. Unfortunately this only works the first time :(

Thanks for any help in advance,

Hi Pedro,

That happens because the auto-complete has a result cache if the inputs are the same.
The best way to do it is to put the input and the autocomplete block of the second menu in a container and then refresh it during the first input OnChange event.

The only side effect is that there is a small delay between the change and the time the lower input is cleared.
I'm attaching your oml with my changes.

João Rosado
Many thanks, João. This worked perfectly!
Using Autocomplete + On Change event still has a problem... if you select an option on the 1st field, using the mouse, it will invoke OnInputChange twice.
You can set a breakpoint there, and/or use Firebug to confirm.

It may be a small thing, but:
  • It's a performance issue, specially in public sites.
  • Depending from case to case, the 2nd request may cause flicker / bad user experience. If you're populating a combobox, for example, depending on the autocomplete input, the user will expand the combobox when it's available (1st ajax request); then the 2nd request kicks in, closing the combo and forcing the user to open it again. I've observed this occurring several times to multiple persons in our current prototype. 

Does anyone found a good workaround for this?