salamebr's Profile

Recent Comments

salamebr posted on 08/18/11 02:30:58 PM
[quote] [quote] Hi Matt,

Thanks for the great tutorial. I coult get it working on my project.

Now, I need 2 autocomplete input elements on the same page and this is not working. :(
When I create the elements (A and B), the ajax response works, but when I click in the autocomplete options returned for the element A, the data goes in both elements A and B.

I believe there is something to do with the auto_complete.js file.

Please, any help?
[end quote]
I hadn't really thought about needing that, but it seems like an obvious next step so I updated the article and added some comments. In your view file, make sure you pass an (unique!) option 'update'=>'id-of-drop-down-div' which the helper will use to create a hidden div. If you copied my css, make sure you change the #autoCompleteDiv to .autoCompleteDiv so that both dropdowns get styled. One problem I found in my original code was that the jQuery function .live didn't work anymore so I had to switch to .bind, and I'm not sure why. I've read blogs that argue one is better than the other, so I couldn't say if I'm doing something wrong. Enjoy!
[end quote]
Yeah, it works now. Thanks.
Still on the auto_complete.js file, on the click function you attach to transfer the value to the text box, I would add the line below, in case you want to hide the loaded options when the user clicks on it:

$('#'+tag).hide();

Also, I am still thinking how to resolve:
A- When the auto-complete option box appear, the user can simply use the arrow keys (up and down) to navigate to the desired option and press ENTER to select.
B- A loader image appear inside the auto-complete box, while the user is tiping.

If I can resolve any of these, I'll post here.
Thanks again, Matt.
salamebr posted on 08/10/11 07:27:18 PM
Hi Matt,

Thanks for the great tutorial. I coult get it working on my project.

Now, I need 2 autocomplete input elements on the same page and this is not working. :(
When I create the elements (A and B), the ajax response works, but when I click in the autocomplete options returned for the element A, the data goes in both elements A and B.

I believe there is something to do with the auto_complete.js file.

Please, any help?