"but it has not
"onselecteditem" or something like that"

sure it does, it's the ".result" event

http://docs.jquery.com/Plugins/Autocomplete/result#handler

So

$("#textbox1").autocomplete(
    "location of remote page",
    { extraPArams: { var1: "foo" }
}).result(function(a, data, b) {
    data = "" + data; //Makes sure it's a string
    //Do something with selected value "data"
});

so anytime something is selected from the autocomplete results,
"result" gets fired and the 2nd parameter is the text of such
selection



On Feb 23, 7:07 am, flanders <[email protected]> wrote:
> Hello MorningZ,
>
> I had tried the plugin from bassistance.de, but it has not
> "onselecteditem" or something like that.
> Now i have a workaround:) i modified the jquery.autocomplete.js from
> bassistance.de. Here my workaround:
>
> function selectCurrent() {
>                 var selected = select.selected();
>                 if( !selected )
>                         return false;
>
>                 var v = selected.result;
>                 previousValue = v;
>
>                 //add this from here
>                 var a2b_ort = selected.data;
>                 var nurort =  a2b_ort.slice(a2b_ort.indexOf(","));
>                 $("input#ort").val(nurort);
>                 // to here
>
>                 if ( options.multiple ) {
>                         var words = trimWords($input.val());
>                         if ( words.length > 1 ) {
>                                 v = words.slice(0, words.length - 1).join
> ( options.multipleSeparator ) + options.multipleSeparator + v;
>                         }
>                         v += options.multipleSeparator;
>                 }
>
>                 $input.val(v);
>                 hideResultsNow();
>                 $input.trigger("result", [selected.data, selected.value]);
>
>                 return true;
>         }
>
>  i hope, someone can use this in future
>
> greets,
> Michael
>
> On Feb 20, 4:34 pm, MorningZ <[email protected]> wrote:
>
> > I'd guess judging by the options you list that you were looking at
> > Jorn's plugin @ bassistance.de
>
> > it does both extraParams and onSelectItem simultaneously....
>
> > On Feb 20, 10:08 am, flanders <[email protected]> wrote:
>
> > > Hello Group,
>
> > > i need an Autocomplete Plugin for jQuery. The Plugin have to handle
> > > extraParams and a "onSelectItem".
> > > i only found many plugins that can only handle extraParams OR
> > > onSelectItem! We have to build a Form like this:
>
> > > [country]
> > > [zip] [city]
>
> > > When coutry is selectet, the ajax have to give me only german zipcodes
> > > back. and when i selected a zipcode, the appendant city had
> > > automaticly fill.
>
> > > have anyone an idea?!
>
> > > greet,
> > > Michael

Reply via email to