Monday, June 1, 2009

[jQuery] Re: AutoComplete with extraParam

On 5/30/09 5:15 PM, "Dushyant Patel" <patel.dushyant@gmail.com> wrote:

>
> Hi All,
>
> I am using AutoComplete plug-in, its working great for me. But now i
> have some new requirement and i am not able to make it work with
> autocomplete.
>
> Requirement is as follow:
>
> Now i need 2 extra parameter to pass and these two parameter's value
> would be depend on selected value of selected box.
>
> So let me explain in details:
>
> $(".mui_search_input").autocomplete('http://weburl/Service.svc/', {
> minChars: 3,
> matchContains: false,
> autoFill: false,
> scrollHeight:200,
> cacheLength: 3,
> mustMatch: true,
> extraParams: { Parm1:"valueofselectionbox1",
> Param2:"valueofselectionbox2"},
>
>
> Here valueofselectionbox1 and valueofselectionbox2 are selection box
> next to search box. so i supposed to get values of those selection box
> and pass as extra parameter.
>
> I tired with following but not working:
>
> extraParams: { Parm1:"$(.selectbox1).val()", Param2:"$(.selectbox2).val
> ()"},

the extraparams need to be functions. otherwise you just set the params to
whatever values are in those selects at the time you called
$(".mui_search_input").autocomplete()

see http://docs.jquery.com/Plugins/Autocomplete#Dependencies_between_fields

No comments: