Autocomplete not working.... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Autocomplete not working.... (/showthread.php?tid=56818) |
Autocomplete not working.... - El Forum - 01-22-2013 [eluser]dauber[/eluser] Hi, all...I'm trying to add an autocomplete to a form I have. In short, when someone types the name of a game, autocomplete should provide suggestions pulled from a MySQL table. I tried using the code/hints from this blog -- http://www.jamipietila.fi/codeigniter-and-autocomplete-with-jquery/ -- to no avail. I posted a message to said blog, but I wanted to post here too 1) to cover all bases, and 2) because folks here have so far been VERY helpful! First, I know for autocomplete to work, you need to have this in config/config.php -- and I do: Code: $config['csrf_protection'] = FALSE; Here's what I put in my view before the closing head tag ("suggestions" is a function I added to my "usergames" controller, and "gameTitle" is the form field I want autocompleted): Code: <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> Here's the "suggestions" function in my controller (the "title" referred to in $row->title refers to the "title" field in the database table I'm trying to pull from): Code: function suggestions() Now, here's what I added into the model: Code: function GetAutocomplete($options = array()) "aararity" is the table I'm trying to pull from, and again, "title" is the name of the field in that table. Basically, when I run the form, there's no autocompletion whatsoever. I'm thinking the "$options[keyword]" parameter might be the problem; I pretty much copied that right from the aforementioned blog, and I'm guessing that might be a vague placeholder used by the author. What am I missing? Autocomplete not working.... - El Forum - 01-23-2013 [eluser]dauber[/eluser] Oops...just realized that the controller is referencing "autocomplete_model," which....heh heh....doesn't exist. Changed it to "usergames_model" and suddenly it works wonderfully. |