Sunday, April 26, 2009

[jQuery] Re: autocomplete

On 4/26/09 2:06 PM, "Marc" <marc.stein@gmail.com> wrote:

>
> I have a silly question...
>
> I am using extraParams to pass additional field values via the URL
>
> $("#findHighSchool").autocomplete("autocomplete_ajax.cfm", {
> width: 260,
> selectFirst: false,
> extraParams:{ STATE:function() { return $("#STATE").val
> ();}
> }
> });
>
> This works correctly. I need to pass a CITY field as well as STATE.
> How do I configure the second extra parameter? All the syntax I've
> tried fails to work.
>
> Do you use multiple extraParams lines or pass both params on the one
> line?
>
> Any help greatly appreciated.

it's hardly a silly question. see if this works:

extraParams:{
STATE:function() { return $("#STATE").val(); },
CITY: function() { return $("#CITY").val(); }
}

something like that works in my app.

it would be sweet if you could write something like:

extraParams: function() { ... }

and have your function return an object with lots of extra params. i looked
at the plugin and it didn't seem easy enough for me to be willing to
attempt.

No comments:

Post a Comment