-
Notifications
You must be signed in to change notification settings - Fork 5
/
multi_value_local_example.html
78 lines (61 loc) · 4.74 KB
/
multi_value_local_example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>example</title>
<link rel="stylesheet" href="autocomplete.css" type="text/css" media="screen" charset="utf-8">
<script type="text/javascript" charset="utf-8" src="lib/prototype.js"></script>
<script type="text/javascript" charset="utf-8" src="lib/scriptaculous.js"></script>
<script type="text/javascript" charset="utf-8" src="lib/effects.js"></script>
<script type="text/javascript" charset="utf-8" src="src/fast_autocompleter.js"></script>
<script type="text/javascript" charset="utf-8" src="multivalue_data.js"></script>
<script type="text/javascript" charset="utf-8">
function lookup(searchString, callback) {
var exp = new RegExp(searchString.gsub(/./, ".*#{0}"), 'i');
callback(multivalue_data.select(function(item) {return exp.test(item);}));
}
var cachedBackend = new Autocompleter.Cache(lookup, {choices: 10});
var cachedLookup = cachedBackend.lookup.bind(cachedBackend);
</script>
</head>
<body>
Page header
<form action="multi_value_local_example.html" method="get" accept-charset="utf-8">
<p>
<input type="text" name="name" value="other field" id="name" style="width: 400px"/>
</p>
<p>
<input type="text" name="people" value="" id="people" style="width: 400px"/>
</p>
<p>
<input type="text" name="cached_people" value="" id="cached_people" style="width: 400px"/>
</p>
<p>
<input type="submit" value="Continue →">
</p>
</form>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<script type="text/javascript" charset="utf-8">
var mvList = new Autocompleter.MultiValue('people', lookup, [], {frequency: 0.1});
var mvListCached = new Autocompleter.MultiValue('cached_people', cachedLookup, [["Mick Staugaard", 0]], {frequency: 0.1});
</script>
</body>
</html>