]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Autocomplete/jquery-autocomplete/todo
Merge branch '0.9.x'
[quix0rs-gnu-social.git] / plugins / Autocomplete / jquery-autocomplete / todo
1 TODO\r
2 \r
3 - test formatItem implementation that returns (clickable) anchors\r
4 - bug: handle del key; eg. type a letter, remove it using del, type same letter again: nothing happens\r
5 - handle up/down keys in textarea (prevent default while select is open?)\r
6 - docs: max:0 works, too, "removing" it(??)\r
7 - fix ac_loading/options.loadingClass\r
8 - support/enable request urls like foo/bar/10 instead of foo/q=10\r
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)\r
10 - test what happens when an element gets focused programmatically (maybe even before then autcomplete is applied)\r
11 - check if blur on selecting can be removed\r
12 - fix keyhandling to ignore metakeys, eg. shift; especially important for chinese characters that need more then one key\r
13 - enhance mustMatch: provide event/callback when a value gets deleted\r
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\r
15 - prevent redundant requests on\r
16   - superstring returned no result, no need to query again for substring, eg. pete returned nothing, peter won't either\r
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)\r
18 - incorporate improvements and suggestions by Hector: http://beta.winserver.com/public/test/MultiSuggestTest.wct\r
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... } \r
20 - accept callback as first argument to let users implement their own dynamic data (no caching) - consider async API\r
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\r
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.\r
23 - add a callback to allow decoding the response\r
24 - allow modification of not-last value in multiple-fields\r
25 @option Number size Limit the number of items to show at once. Default: \r
26 @option Function parse - TEST AND DOCUMENT ME\r
27 - add option to display selectbox on focus\r
28 \r
29 $input.bind("show", function() {\r
30         if ( !select.visible() ) {\r
31                 onChange(0, true);\r
32         }\r
33 });\r
34 \r
35 - reference: http://capxous.com/\r
36   - add "try ..." hints to demo\r
37   - check out demos\r
38 - reference: http://createwebapp.com/demo/\r
39   \r
40 - add option to hide selectbox when no match is found - see comment by Ian on plugin page (14. Juli 2007 04:31)\r
41 - add example for reinitializing an autocomplete using unbind()\r
42 \r
43 - Add option to pass through additional arguments to $.ajax, like type to use POST instead of GET\r
44 \r
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.\r
46 -> add that hint to docs and examples\r
47 \r
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.\r
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.\r
50 \r
51 xml example:\r
52 <script type="text/javascript">\r
53       function parseXML(data) {\r
54         var results = [];\r
55         var branches = $(data).find('item');\r
56         $(branches).each(function() {\r
57           var text = $.trim($(this).find('text').text());\r
58           var value = $.trim($(this).find('value').text());\r
59           //console.log(text);\r
60           //console.log(value);\r
61           results[results.length] = {'data': this, 'result': value, 'value': text};\r
62         });\r
63         $(results).each(function() {\r
64           //console.log('value', this.value);\r
65           //console.log('text', this.text);\r
66         });\r
67         //console.log(results);\r
68         return results;\r
69       };\r
70     $(YourOojHere).autocomplete(SERVER_AJAX_URL, {parse: parseXML});\r
71   </script>\r
72 <?xml version="1.0"?>\r
73 <ajaxresponse>\r
74   <item>\r
75     <text>\r
76       <![CDATA[<b>FreeNode:</b> irc.freenode.net:6667]]>\r
77     </text>\r
78     <value><![CDATA[irc.freenode.net:6667]]></value>\r
79   </item><item>\r
80     <text>\r
81       <![CDATA[<b>irc.oftc.net</b>:6667]]>\r
82     </text>\r
83     <value><![CDATA[irc.oftc.net:6667]]></value>\r
84   </item><item>\r
85     <text>\r
86       <![CDATA[<b>irc.undernet.org</b>:6667]]>\r
87     </text>\r
88     <value><![CDATA[irc.undernet.org:6667]]></value>\r
89   </item>\r
90 </ajaxresponse>\r
91   \r
92   \r
93 \r
94 Hi all,\r
95 \r
96 I use Autocomplete 1.0 Alpha mostly for form inputs bound to foreign\r
97 key columns. For instance I have a user_position table with two\r
98 columns: user_id and position_id. On new appointment form I have two\r
99 autocomplete text inputs with the following code:\r
100 \r
101    <input type="text" id="user_id" class="ac_input"  tabindex="1" />\r
102    <input type="text" id="position_id" class="ac_input" tabindex="2" />\r
103 \r
104 As you can see the inputs do not have a name attribute, and when the\r
105 form is submitted their values are not sent, which is all right since\r
106 they will contain strings like:\r
107 \r
108    'John Doe'\r
109    'Sales Manager'\r
110 \r
111 whereas our backend expects something like:\r
112 \r
113    23\r
114    14\r
115 \r
116 which are the user_id for John Doe and position_id for Sales Manager.\r
117 To send these values I have two hidden inputs in the form like this:\r
118 \r
119    <input type="hidden" name="user_id" value="">\r
120    <input type="hidden" name="position_id" value="">\r
121 \r
122 Also I have the following code in the $().ready function:\r
123 \r
124    $("#user_id").result(function(event, data, formatted) {\r
125      $("input[@name=user_id]").val(data[1]);\r
126    });\r
127    $("#position_id").result(function(event, data, formatted) {\r
128      $("input[@name=position_id]").val(data[1]);\r
129    });\r
130 \r
131 As could be seen these functions stuff user_id and position_id values\r
132 (in our example 23 and 14) into the hidden inputs, and when the form\r
133 is submitted these values are sent:\r
134 \r
135    user_id = 23\r
136    position_id = 14\r
137 \r
138 The backend script then takes care of adding a record to our\r
139 user_position table containing those values.\r
140 \r
141 I wonder how could the plugin code be modified to simplify the setup\r
142 by taking care of adding hidden inputs and updating the value of\r
143 hidden inputs as default behavior. I have successfully attempted a\r
144 simpler solution - writing a wrapper to perform these additional tasks\r
145 and invoke autocomplete as well. I hope my intention is clear enough,\r
146 if not, this is exactly the expected outcome:\r
147 \r
148 Before:\r
149 \r
150    <script type="text/javascript"\r
151    src="jquery.autocomplete-modified.js"></script>\r
152    <input type="text" name="user_id" class="ac_input" tabindex="1" />\r
153 \r
154 After:\r
155 \r
156    <input type="text" id="user_id" class="ac_input" tabindex="1" />\r
157    <input type="hidden" name="user_id" value="23">\r
158 \r
159 \r
160 Last word, I know this looks like a tall order, and I do not hope\r
161 someone will make a complete working mod for me, but rather would very\r
162 much appreciate helpful  advise and directions.\r
163 \r
164 Many thanks in advance\r
165 Majid\r
166 \r