Welcome Guest, Not a member yet? Register   Sign In
Autosuggest search box using CI and JQuery
#1

[eluser]Hermann007[/eluser]
Hi everyone. This is my first post in this forum. I have just recently began using frameworks so excuse my ignorance if so. I started out experimenting with Yii but found that not to suite me so I tried out CI and thusfar I'm really impressed. I have run into a slight problem though. I'm trying to implement a search functionality into my site where a user should be able to see suggestions from numerous categories etc as he/she types. This auto suggest also needs to contain thumbnails and if a user clicks on a suggestion he needs to be redirected to that specific item.

I have used this exact search box in a previous project and this is exactly what I want to achieve. The problem now is that I cant get this to work in CI. How do I implement this to be MVC oriented and functional in CI?

Please this current project is only for learning more about the framework so excuse me if this question seems idiotic to some more experienced CI developers but I would really like to learn how to do this and can't find any resources on this topic.

Further, and I know this is not a JQuery forum but can someone perhaps point me in the direction of a tutorial on how to make the autosuggest keyboard responsive?

Thank you very much and please do keep up the good work CI!!

Kind Regards,
Hermann
#2

[eluser]InsiteFX[/eluser]
AutoComplete with CodeIgniter

Read the comments also.
#3

[eluser]Hermann007[/eluser]
Thank you for the response InsiteFX. I will most certainly give it a go and get back to you but the effort is appreciated!
#4

[eluser]Hermann007[/eluser]
I have gone through this tutorial carefully and I have to give credit that it has been done very clearly. I could not get it to work however. I started out with a customized version (own values etc. and this form needs to be included in my header on every page in the site) but later even tried to do an exact copy of the tutorial with the same values, db's etc. None of these attempts were successful. Typing something into the textbox doesn't even generate an autocomplete dropdown. This is exactly the same problem that occurred with other autocomplete tutorials as well so I'm starting to wonder if it might perhaps have something to do with my site setup? I do have a .htaccess removing index.php from the url but I'm not sure if this might have an effect. Like I also stated before in my first post....the example is exactly what I want to do and it works out of the box but the moment that I try to implement it on my CI site it doesn't present any autosuggestions.....

My .htaccess looks like this:

Code:
RewriteEngine on
RewriteBase /
# Hide the application and system directories by redirecting the request to index.php
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]



I really don't know where to turn any more as this is something that I've been struggling with for close to three weeks now and I've tried all of the available tutorials etc. available on this subject. Firstly in Yii and now in CI....have to say that all of the other tasks at least make CI worth my while.
#5

[eluser]InsiteFX[/eluser]
Try this one by jQuery UI

jQuery UI - Autocomplete
#6

[eluser]Hermann007[/eluser]
I've already tried them all. Including this one. All of them give the same result. No dropdown as you type. The most logical explanation would be that jQuery etc. is not included but believe me it is as I'm also using twitter Bootstrap with working dropdown menus (dependent on javascript).

I will give this option another go and see what it delivers.
#7

[eluser]InsiteFX[/eluser]
After Christmas I will take a look at it and post a working copy.
#8

[eluser]Hermann007[/eluser]
Thank you very much InsiteFX for all your trouble and have a wonderful Christmas. I will let you know asap if I have any success!!
#9

[eluser]InsiteFX[/eluser]
Merry Christmas, here is a working copy of autocomplete

It was tested in my menu testing project but you should be able to pull it out.

download autocomplete

Everything is named autocomplete etc; Also there is a mytable.sql file in the root.

Also see the assets_helper and assets directory.

Change the database settings to your own.
#10

[eluser]Hermann007[/eluser]
Thank you very much for your efforts InsiteFX. This was so easy to follow and implement. I really appreciate it. Will now try to add thumbnail images and mouse click redirect on my own! Thank you so much once again!!

Regards,
Hermann.




Theme © iAndrew 2016 - Forum software by © MyBB