[TYPO3-irre] Autocomplete (was: Perfomance and usability issue)

David Bruehlmeier typo3 at bruehlmeier.com
Thu Apr 5 09:15:38 CEST 2007


Hi all,

as announced in the thread "Perfomance and usability issue", I have 
implemented an alpha version of an autocomplete feature for backend 
fields. The functionality is based on the script.aculo.us Autocompleter 
control.

Currently, two scenarios are possible:

a) Hints for a regular input field (à la Google Suggest). The hints are 
selected from a foreign table and can be chosen - or not. Either way, 
any value can be entered into the field and the value is stored to the 
database.

b) Alternative for a select field. This can be used e.g. for 
static_countries or, in the case of the Party Information Framework - 
for the addresses, etc. Only values which really are in the foreign 
table can be selected. Other values are disregarded. The UID of the 
foreign record is stored to the database.

Since this was the first time I have worked with Ajax, it was quite an 
adventure for me... :-) But now the base works fine. What remains are a 
few points which I would like to discuss with you:

1. I only got the Autocomplete control to work when it was included in 
the header. That's why i moved all Prototype JS to alt_doc.php. Is this 
ok? Other suggestions?

2. I decided to implement the Autocomplete control as a new field type. 
Reasons:
a) Mix of type 'input' and 'select' with various restrictions (i.e. only 
makes sense for select with min/max=1). With own field type, this is 
easier to understand and document.
b) Easier to implement, since it can be cleanly 'encapsulated'


Some TODO's also remain, among which:
* Deleting of field values with internal type 'select' (adapted onchange 
function?)
* For internal_type = select, when a valid entry is typed directly to 
the field without choosing it from the hints, also accept is as a valid 
input (adapted onchange function?)
* Mark the parts of the search string which matched the results
* When multiple results are fetched from the database, show number of 
results


The new feature can be "installed" by applying the following patch 
(based on revision 2250 of the core in SVN):
http://www.bruehlmeier.com/tx_party/autocomplete.diff

This small test-extension uses the Autocompleter in both scenarios:
http://www.bruehlmeier.com/tx_party/T3X_test_autocomplete-0_0_0-z-200704050909.t3x

I invite you to try out this feature and let me know what you think! I 
will leave for vacation tonight and will be back on April 16, so don't 
be surprised if I don't reply before. :-)

Greetings,
Dave


More information about the TYPO3-project-irre mailing list