jQuery: The Write Less, Do More JavaScript Library

Help with Autocomplete - hopefully an easy one

View: New views
5 Messages — Rating Filter:   Alert me  

Help with Autocomplete - hopefully an easy one

by mgl-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello folks,

I'm just looking at the jQuery Autocomplete plugin (http://
docs.jquery.com/Plugins/Autocomplete), and it looks pretty good for
what I need to do.  In the demo (http://jquery.bassistance.de/
autocomplete/demo/), the second input is pretty much what I'm looking
for - where a user can hit the down-key and view a list of possible
options without having to first type a search term.  What I would like
to know is how to trigger that dropdown remotely (e.g., by clicking a
down-arrow button - many of my target users are not likely to think of
hitting the down key without specific instructions).  I tried this on
the demo page:

$("input#month").search();

..but nothing happens.  Have I misunderstood the documentation?  Is
there an option I need to set first?


Re: Help with Autocomplete - hopefully an easy one

by Jörn Zaefferer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


For minChars:0, the list shows when the input has focus an gets
clicked again. There isn't a programmatic way to do that, yet.
search() avoids the visual list completely.

Jörn

On Wed, Jul 23, 2008 at 8:10 AM, mgl <mgl.gis@...> wrote:

>
> Hello folks,
>
> I'm just looking at the jQuery Autocomplete plugin (http://
> docs.jquery.com/Plugins/Autocomplete), and it looks pretty good for
> what I need to do.  In the demo (http://jquery.bassistance.de/
> autocomplete/demo/), the second input is pretty much what I'm looking
> for - where a user can hit the down-key and view a list of possible
> options without having to first type a search term.  What I would like
> to know is how to trigger that dropdown remotely (e.g., by clicking a
> down-arrow button - many of my target users are not likely to think of
> hitting the down key without specific instructions).  I tried this on
> the demo page:
>
> $("input#month").search();
>
> ..but nothing happens.  Have I misunderstood the documentation?  Is
> there an option I need to set first?
>
>

Re: Help with Autocomplete - hopefully an easy one

by mgl-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ok...I did figure out to make this work...it's not pretty, but it gets
the job done:

$("input#month").trigger("focus");
$("input#month").trigger("click");
$("input#month").trigger("click");

I ran that in Firebug on the sample page for autocomplete, and it
worked pretty much the way I want, so I guess that's all I need for
now.  It would be nice to have a single method that could be called to
do the same though.

On Jul 24, 8:01 am, "Jörn Zaefferer" <joern.zaeffe...@...>
wrote:

> For minChars:0, the list shows when the input has focus an gets
> clicked again. There isn't a programmatic way to do that, yet.
> search() avoids the visual list completely.
>
> Jörn
>
> On Wed, Jul 23, 2008 at 8:10 AM, mgl <mgl....@...> wrote:
>
> > Hello folks,
>
> > I'm just looking at the jQuery Autocomplete plugin (http://
> > docs.jquery.com/Plugins/Autocomplete), and it looks pretty good for
> > what I need to do.  In the demo (http://jquery.bassistance.de/
> > autocomplete/demo/), the second input is pretty much what I'm looking
> > for - where a user can hit the down-key and view a list of possible
> > options without having to first type a search term.  What I would like
> > to know is how to trigger that dropdown remotely (e.g., by clicking a
> > down-arrow button - many of my target users are not likely to think of
> > hitting the down key without specific instructions).  I tried this on
> > the demo page:
>
> > $("input#month").search();
>
> > ..but nothing happens.  Have I misunderstood the documentation?  Is
> > there an option I need to set first?

Re: Help with Autocomplete - hopefully an easy one

by Jörn Zaefferer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Yeah, not pretty. You can simplify it a bit, though:
$("#month").focus().click().click();

Jörn

On Thu, Jul 24, 2008 at 12:35 AM, mgl <mgl.gis@...> wrote:

>
> Ok...I did figure out to make this work...it's not pretty, but it gets
> the job done:
>
> $("input#month").trigger("focus");
> $("input#month").trigger("click");
> $("input#month").trigger("click");
>
> I ran that in Firebug on the sample page for autocomplete, and it
> worked pretty much the way I want, so I guess that's all I need for
> now.  It would be nice to have a single method that could be called to
> do the same though.
>
> On Jul 24, 8:01 am, "Jörn Zaefferer" <joern.zaeffe...@...>
> wrote:
>> For minChars:0, the list shows when the input has focus an gets
>> clicked again. There isn't a programmatic way to do that, yet.
>> search() avoids the visual list completely.
>>
>> Jörn
>>
>> On Wed, Jul 23, 2008 at 8:10 AM, mgl <mgl....@...> wrote:
>>
>> > Hello folks,
>>
>> > I'm just looking at the jQuery Autocomplete plugin (http://
>> > docs.jquery.com/Plugins/Autocomplete), and it looks pretty good for
>> > what I need to do.  In the demo (http://jquery.bassistance.de/
>> > autocomplete/demo/), the second input is pretty much what I'm looking
>> > for - where a user can hit the down-key and view a list of possible
>> > options without having to first type a search term.  What I would like
>> > to know is how to trigger that dropdown remotely (e.g., by clicking a
>> > down-arrow button - many of my target users are not likely to think of
>> > hitting the down key without specific instructions).  I tried this on
>> > the demo page:
>>
>> > $("input#month").search();
>>
>> > ..but nothing happens.  Have I misunderstood the documentation?  Is
>> > there an option I need to set first?
>

Re: Help with Autocomplete - hopefully an easy one

by mgl-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ok, thanks.

Just out of curiosity, is it possible to re-display the entire list
after a value has been selected?  Let's say I have a list of 100
possible options - I have a dropdown button that makes this list
appear (using focus().click().click()), while typing in the textbox
will narrow the results as per the intended functionality of the
autocomplete plugin.  However, if a value has been selected, is it
possible to somehow make the entire list reappear with the current
option highlighted (kind of like a standard drop-down select works)?
The only way to approximate this from what I can tell would be clear
the current value of the input.

Perhaps I should just stick with a standard dropdown select object,
but being able to use this autocomplete for a large list of options is
really handy.

On Jul 24, 7:27 pm, "Jörn Zaefferer" <joern.zaeffe...@...>
wrote:

> Yeah, not pretty. You can simplify it a bit, though:
> $("#month").focus().click().click();
>
> Jörn
>
> On Thu, Jul 24, 2008 at 12:35 AM, mgl <mgl....@...> wrote:
>
> > Ok...I did figure out to make this work...it's not pretty, but it gets
> > the job done:
>
> > $("input#month").trigger("focus");
> > $("input#month").trigger("click");
> > $("input#month").trigger("click");
>
> > I ran that in Firebug on the sample page for autocomplete, and it
> > worked pretty much the way I want, so I guess that's all I need for
> > now.  It would be nice to have a single method that could be called to
> > do the same though.
>
> > On Jul 24, 8:01 am, "Jörn Zaefferer" <joern.zaeffe...@...>
> > wrote:
> >> For minChars:0, the list shows when the input has focus an gets
> >> clicked again. There isn't a programmatic way to do that, yet.
> >> search() avoids the visual list completely.
>
> >> Jörn
>
> >> On Wed, Jul 23, 2008 at 8:10 AM, mgl <mgl....@...> wrote:
>
> >> > Hello folks,
>
> >> > I'm just looking at the jQuery Autocomplete plugin (http://
> >> > docs.jquery.com/Plugins/Autocomplete), and it looks pretty good for
> >> > what I need to do.  In the demo (http://jquery.bassistance.de/
> >> > autocomplete/demo/), the second input is pretty much what I'm looking
> >> > for - where a user can hit the down-key and view a list of possible
> >> > options without having to first type a search term.  What I would like
> >> > to know is how to trigger that dropdown remotely (e.g., by clicking a
> >> > down-arrow button - many of my target users are not likely to think of
> >> > hitting the down key without specific instructions).  I tried this on
> >> > the demo page:
>
> >> > $("input#month").search();
>
> >> > ..but nothing happens.  Have I misunderstood the documentation?  Is
> >> > there an option I need to set first?
LightInTheBox - Buy quality products at wholesale price