1

Topic: ZC59 – Autocomplete Control with ZendX_JQuery

In the last video, I discussed ZendX_JQuery integration. Now we're going to take it a step further by developing our own jQuery autocomplete control, using a country list, PHP 5.3 and anonymous functions.

2

Re: ZC59 – Autocomplete Control with ZendX_JQuery

Hey Jon,

First I want to thank you for the good work, nice videos and stuff.
I've tried the video based with some extras like db connection and form controller, but i have an issue ginving extraParams.

I want people to select a user and return the ID value and not the name  of this user.

Did you experience this already?

thx,

Xavier

3

Re: ZC59 – Autocomplete Control with ZendX_JQuery

Hi Xavier,

In order to get this sort of thing to work, you'll have to probably pass back more than just a list of usernames. I'm not sure how much flexibility the autocomplete control has in this regard, but you would want to send back a small json structure for each result.

e.g.
[{"user" : "Jon" , "id" : 23}, {"user": "Xavier" , "id" :24}, ...]

once you have it in this format coming from the server, you could then parse it on the client so that the username is all that shows up and you could store the id either in the DOM or in a variable on the page.

Hope that helps,
-
Jon

4

Re: ZC59 – Autocomplete Control with ZendX_JQuery

hi,

I tried an tried, but nothing seems to work out ...

JQuery wants something like :["User1","User2","User3"]

Someone already figured outs a problem like this?

I want to replace a dropdown, but it needs to do the trick offcourse ...

5

Re: ZC59 – Autocomplete Control with ZendX_JQuery

Dump your code snippet...

6

Re: ZC59 – Autocomplete Control with ZendX_JQuery

Hey,

found a prefect solution for me.

Instead of pretending the combobox, overwrite him ...

found the code here and i works like a charm!

http://jqueryui.com/demos/autocomplete/#combobox

thx for the feedback guys

7

Re: ZC59 – Autocomplete Control with ZendX_JQuery

Thanks for sharing Xavier smile