Ok I've figured it out. I noticed the "hidden input" under the Single
Bird example and this bit of code in the demo source:
        $("#singleBirdRemote").result(function(event, data, formatted) {
                if (data)
                        $(this).parent().next().find("input").val(data[1]);
        });


Changed that to $(this) bit to... $("#link_id").val(data[1]); to
access the input with id=link_id explicitly
Hope this helps someone out.

Cheers, B



On Jun 5, 4:27 pm, batfastad <batfas...@yahoo.co.uk> wrote:
> Hi everyone
>
> Been experimenting with the autocomplete plugin (http://
> docs.jquery.com/Plugins/Autocomplete/autocomplete#url_or_dataoptions)
> Couldn't wait until it was incorporated into jQuery UI ;)
>
> What I'm trying to achieve is to use the box to search for a company,
> but actually to get hold of the company ID then save that into my
> database.
> At the moment users have to look up the company_id manually and enter
> it into a field, which is totally stupid these days!
>
> I've been using the Single Bird (remote) example on this 
> page...http://view.jquery.com/trunk/plugins/autocomplete/demo/
> That demo gets the data from this 
> script...http://view.jquery.com/trunk/plugins/autocomplete/demo/search.phpsand
> you notice in the output it returns 2 values separated by a | pipe
> character. The bird name and the latin name.
> Got my server-side script sorted and I've been trying to adapt that
> example so it returns:
> company_name|company_id
> company_name2|company_id2
>
> The autocomplete seems to work (though I need to tweak the options a
> bit to get it perfect) but how do I access the value after the | pipe
> character?
> It's that company_id that I'm actually trying to get hold of in my
> script
> Sort of like how the option HTML tag behaves... <option
> value="company_id">company_name</option>, so the user only sees
> company_name, but actually they're entering company_id into my form.
>
> Any ideas/suggestions on the best way to do this?
>
> Cheers, B
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to jquery-ui@googlegroups.com
To unsubscribe from this group, send email to 
jquery-ui+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to