JQuery Autocomplete - format listing and only return a part to the text box
- by Jason
I'm using the JQuery Autocomplete and it's working just fine.
I'm using it to allow someone to search for users out of a database by searching on last name or id number.
Right now the drop down list that is created is the resultes of a SQL query and looks something like:
$row_rst['lName'] . ', ' . $row_rst['fName'] . " - " . $row_rst['user'] . "|" . $row_rst['id']
which outputs something like:
Jones, Henry - hjones
Gibbons, Peter - pgibbons
When I pick Henry the text box gets Jones, Henry - hjones and the hidden field gets his id.
I'd like to format the drop down in columns if possible and only return Jones, Henry to the text box if possible.
Are either of those options possible? I'm thinking it has to do with either formatItem(row) or formatResult(row) but I'm not sure and I can't seem to find how to go about this.