Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.
/ Facelist Public archive

Facelist is an input field capable of accepting multiple items from an autocomplete list similar to Facebook mail recipient field.

Notifications You must be signed in to change notification settings

iantearle/Facelist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Facelist

Built for the sole purpose of providing a Facebook style autosearch.

Facelist provides an autocomplete suggestive search built with jQuery and a little CSS3 wizardry. Its easy to set up, implement and is completely open source, meaning you can edit, cannibalise and change the underlying code.

Implementation

Calling Facelist

The simplest implementation to get Facelist working is by adding the code below. This will apply a Facelist control to every input on your page.

$(function(){ $("input[type=text]").faceList(data); });

Enabling Multiple Uses

To enable multiple Facelists containing different data make your selections with different calls:

$(function(){ $("div.anclass input").faceList(data); $("#anid input").faceList(other_data); });

Defining URI

You can define a URI for the data:

$("input[type=text]").faceList("http://yoursite.com/path/to/script", {minChars: 3, matchCase: true});

AJAX Call

An example of the PHP used for an AJAX call to a script on your site can be made like so:

$input = $_GET["q"]; $data = array(); $query = mysql_query("SELECT * FROM table WHERE field LIKE '%$input%'"); while ($row = mysql_fetch_assoc($query)) { $json = array(); $json['value'] = $row['id']; $json['name'] = $row['username']; $json['image'] = $row['user_photo']; $data[] = $json; } header("Content-type: application/json"); echo json_encode($data);

MIT License

Copyright (c) 2011 Ian Tearle

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Facelist is an input field capable of accepting multiple items from an autocomplete list similar to Facebook mail recipient field.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published