views:

40

answers:

2

I've got a YUI AutoComplete control, works great. Except that I'd like it to expand the list of suggestions as soon as the user selects the input box. How do I make that happen?

Right now expansion doesn't happen until the user hits a key in the box.

+1  A: 

You can use the textboxFocusEvent to send a query of the contents of the input, which will open the results pane. I tried using expandContainer without success but wasn't sure that would have worked anyways.

Working Example: http://tivac.com/yui2/autocomplete_jamesmoore.htm

Tivac
This is what I ended up doing - thanks
James Moore
+1  A: 

Tivac has the right idea -- use textboxFocusEvent to send an empty query that returns results to populate the container. Check out this example for some sample code: http://developer.yahoo.com/yui/examples/autocomplete/ac_combobox.html

Jenny Donnelly
Yes, although you probably don't want to just send an empty query. The user could be coming back to a field that has something in it, so query with the contents (which will be empty to start with).
James Moore