php - cakePHP Assisted Form Input -


i'm trying figure out how create assisted input field based on search query. greatest example of dropdown 1 sees when 1 begins writing in google or facebook search bars, assisting user's input.

my customer has requested feature , know not how implement within formhelper class. ideas? perhaps answer?

what need jquery ui's autocomplete: http://jqueryui.com/autocomplete/

it's front-end thing done javascript. thing need back-end specifying possible options user has in dropdown.

one way of doing have array populate availabletags parameter. example, static autocomplete might have following (taken example on page linked above):

var availabletags = [   "actionscript",   "applescript",   "asp",   "basic",   "c",   "c++",   "clojure",   "cobol",   "coldfusion",   "erlang",   "fortran",   "groovy",   "haskell",   "java",   "javascript",   "lisp",   "perl",   "php",   "python",   "ruby",   "scala",   "scheme" ]; 

you store tags in array using cakephp, , in view:

var availabletags = [   <?php foreach ($tags_array $tag) echo '"' . $tag . '",'; ?> ]; 

Comments