Robert O'Rourke wrote:
Hi there,
I'm putting together an editable combobox using the twice modified
autocomplete plugin (Dylan Verhuel's I think). I start with a dropdown
and a text input, then create an array from the <option>s values. I
replace the static HTML with a single text input followed by a link
that I want to use as a toggle to open and close the dropdown created
by the autocomplete plugin. Essentially I want to mimick the behaviour
of select boxes but allow it to take new values too.
I've run into some difficulty interacting with the events etc...
that the plugin creates. Could someone point me in the right direction
to how I can access the show/hide functions and also to add a function
that lets me differentiate between when the input is populated with an
option from the list and a new value?
Any guidance you can offer me would be awesome, I'm working on a
test page here:
http://www.sanchothefat.com/dev/jsdemos/combo-box.html
That is worth another plugin, which must be highly integrated with the
autocomplete plugin. I like your unobtrusive approach of starting with
both a dropdown and an input field.
Due to lack of time I can currently only try to get you started. Please
try to insert this into the autocomplete plugin, before or after the
$input.keydown(... block:
$input.bind("show", function() {
if ( !select.visible() ) {
onChange(0, true);
}
});
Afterwards you should be able to trigger showing the selectbox
programmatically:
$("#myinput").autocomplete(...).trigger("show");
You're already setting minChars to zero, so that should work...
--
Jörn Zaefferer
http://bassistance.de