comparison sites/all/modules/custom/solrsearch_autocomplete/jquery-autocomplete/todo @ 0:015d06b10d37 default tip

initial
author dwinter
date Wed, 31 Jul 2013 13:49:13 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:015d06b10d37
1 TODO
2
3 - test formatItem implementation that returns (clickable) anchors
4 - bug: handle del key; eg. type a letter, remove it using del, type same letter again: nothing happens
5 - handle up/down keys in textarea (prevent default while select is open?)
6 - docs: max:0 works, too, "removing" it(??)
7 - fix ac_loading/options.loadingClass
8 - support/enable request urls like foo/bar/10 instead of foo/q=10
9 - urlencode request term before passing to $.ajax/data; evaluate why $.ajax doesn't handle that itself, if at all; try with umlauts, russian/danish/chinese characeters (see validate)
10 - test what happens when an element gets focused programmatically (maybe even before then autcomplete is applied)
11 - check if blur on selecting can be removed
12 - fix keyhandling to ignore metakeys, eg. shift; especially important for chinese characters that need more then one key
13 - enhance mustMatch: provide event/callback when a value gets deleted
14 - handle tab key different then enter, eg. don't blur field or prevent default, just let it move on; in any case, no need to blur the field when selecting a value via tab, unlike return
15 - prevent redundant requests on
16 - superstring returned no result, no need to query again for substring, eg. pete returned nothing, peter won't either
17 - previous query mustn't be requested again, eg. pete returns 10 lines, peter nothing, backspace to pete should get the 10 lines from cache (may need TimeToLive setting for cache to invalidate it)
18 - incorporate improvements and suggestions by Hector: http://beta.winserver.com/public/test/MultiSuggestTest.wct
19 - json support: An optional JSON format, that assumes a certain JSON format as default and just looks for a dataType "json" to be activated; [records], where each record is { id:String, label:String, moreOptionalValues... }
20 - accept callback as first argument to let users implement their own dynamic data (no caching) - consider async API
21 - allow users to keep their incomplete value when pressing tab, just mimic the default-browser-autocomplete: tab doesn't select any proposed value -> tab closes the select and works normal otherwise
22 - small bug in your autocomplete, When setting autoFill:true I would expect formatResult to be called on autofill, it seems not to be the case.
23 - add a callback to allow decoding the response
24 - allow modification of not-last value in multiple-fields
25 @option Number size Limit the number of items to show at once. Default:
26 @option Function parse - TEST AND DOCUMENT ME
27 - add option to display selectbox on focus
28
29 $input.bind("show", function() {
30 if ( !select.visible() ) {
31 onChange(0, true);
32 }
33 });
34
35 - reference: http://capxous.com/
36 - add "try ..." hints to demo
37 - check out demos
38 - reference: http://createwebapp.com/demo/
39
40 - add option to hide selectbox when no match is found - see comment by Ian on plugin page (14. Juli 2007 04:31)
41 - add example for reinitializing an autocomplete using unbind()
42
43 - Add option to pass through additional arguments to $.ajax, like type to use POST instead of GET
44
45 - I found out that the problem with UTF-8 not being correctly sent can be solved on the server side by applying (PHP) rawurldecode() function, which decodes the Unicode characters sent by GET method and therefore URL-encoded.
46 -> add that hint to docs and examples
47
48 But I am trying this with these three values: “foo bar”, “foo foo”, and “foo far”, and if I enter “b” (or “ba”) nothing matches, if I enter “f” all three do match, and if I enter “fa” the last one matches.
49 The problem seems to be that the cache is implemented with a first-character hashtable, so only after matching the first character, the latter ones are searched for.
50
51 xml example:
52 <script type="text/javascript">
53 function parseXML(data) {
54 var results = [];
55 var branches = $(data).find('item');
56 $(branches).each(function() {
57 var text = $.trim($(this).find('text').text());
58 var value = $.trim($(this).find('value').text());
59 //console.log(text);
60 //console.log(value);
61 results[results.length] = {'data': this, 'result': value, 'value': text};
62 });
63 $(results).each(function() {
64 //console.log('value', this.value);
65 //console.log('text', this.text);
66 });
67 //console.log(results);
68 return results;
69 };
70 $(YourOojHere).autocomplete(SERVER_AJAX_URL, {parse: parseXML});
71 </script>
72 <?xml version="1.0"?>
73 <ajaxresponse>
74 <item>
75 <text>
76 <![CDATA[<b>FreeNode:</b> irc.freenode.net:6667]]>
77 </text>
78 <value><![CDATA[irc.freenode.net:6667]]></value>
79 </item><item>
80 <text>
81 <![CDATA[<b>irc.oftc.net</b>:6667]]>
82 </text>
83 <value><![CDATA[irc.oftc.net:6667]]></value>
84 </item><item>
85 <text>
86 <![CDATA[<b>irc.undernet.org</b>:6667]]>
87 </text>
88 <value><![CDATA[irc.undernet.org:6667]]></value>
89 </item>
90 </ajaxresponse>
91
92
93
94 Hi all,
95
96 I use Autocomplete 1.0 Alpha mostly for form inputs bound to foreign
97 key columns. For instance I have a user_position table with two
98 columns: user_id and position_id. On new appointment form I have two
99 autocomplete text inputs with the following code:
100
101 <input type="text" id="user_id" class="ac_input" tabindex="1" />
102 <input type="text" id="position_id" class="ac_input" tabindex="2" />
103
104 As you can see the inputs do not have a name attribute, and when the
105 form is submitted their values are not sent, which is all right since
106 they will contain strings like:
107
108 'John Doe'
109 'Sales Manager'
110
111 whereas our backend expects something like:
112
113 23
114 14
115
116 which are the user_id for John Doe and position_id for Sales Manager.
117 To send these values I have two hidden inputs in the form like this:
118
119 <input type="hidden" name="user_id" value="">
120 <input type="hidden" name="position_id" value="">
121
122 Also I have the following code in the $().ready function:
123
124 $("#user_id").result(function(event, data, formatted) {
125 $("input[@name=user_id]").val(data[1]);
126 });
127 $("#position_id").result(function(event, data, formatted) {
128 $("input[@name=position_id]").val(data[1]);
129 });
130
131 As could be seen these functions stuff user_id and position_id values
132 (in our example 23 and 14) into the hidden inputs, and when the form
133 is submitted these values are sent:
134
135 user_id = 23
136 position_id = 14
137
138 The backend script then takes care of adding a record to our
139 user_position table containing those values.
140
141 I wonder how could the plugin code be modified to simplify the setup
142 by taking care of adding hidden inputs and updating the value of
143 hidden inputs as default behavior. I have successfully attempted a
144 simpler solution - writing a wrapper to perform these additional tasks
145 and invoke autocomplete as well. I hope my intention is clear enough,
146 if not, this is exactly the expected outcome:
147
148 Before:
149
150 <script type="text/javascript"
151 src="jquery.autocomplete-modified.js"></script>
152 <input type="text" name="user_id" class="ac_input" tabindex="1" />
153
154 After:
155
156 <input type="text" id="user_id" class="ac_input" tabindex="1" />
157 <input type="hidden" name="user_id" value="23">
158
159
160 Last word, I know this looks like a tall order, and I do not hope
161 someone will make a complete working mod for me, but rather would very
162 much appreciate helpful advise and directions.
163
164 Many thanks in advance
165 Majid
166