How to create an auto filter result list based on the content of an input field

Discussion created by Heine on Mar 5, 2014

Hi guys!


It's all over the place, all these auto complete/dynamic filtering thingies which will attempt to complete whatever query you're putting in to a given field on a webpage. I love them, but I don't know how to make them work the way I want them to.


I can make them retreieve data from one field using this http://jqueryui.com/autocomplete/ example, but basically it is just a lookup in a static list included in the file being loaded AND it's only the text bit, not containing ID's. While that's all good and well for a standard 'search' feature, it is just not good enough for a form which either creates OR edits a given record via PHP (FMStudio PRO).


Let's say that I have a table that holds all of my info on project registration. Each assignment has a person responsible, amongst other things. This particular PR is stored in a separate table to avoid misspellings etc. Each PR therefore has his/her own unique ID. In the assignment table I have a "PR" field wich ONLY contains the unique ID for that person, and I then have a relationship to the PR table, in order to retreive the name (human readable) ;-)


What I would love to do is to be able to create a new/edit assignment from a php page, and to be able to start typing in letters in the 'PR' field and then have the php/jQuery (AJAX) return the filtered list of people matching my input, WITH the ID (SHOWN or HIDDEN) for that particular person...


Donøt know if it is possible at all, but I sure would like your input on this!