The patch was done against revision 381. These changes have been tested on Opera 8.5, IE 6 and Firefox 1.5. I think the widget now is pretty enough to be used free of shame :)

   * Made the AutoCompleteField look a lot better
* Fixed a bug in the AutoCompleteField widget template, it wasn't including the attributes got via the attrs parameter on the Widget constructor. You need it to be able to specify the field size, for example: field = AutoCompleteField(attrs=dict(size=50,maxlength=50))

* Added a spinner image that "spins" while the AJAX request is in process (this was done pretty fast and needs some cleaning, specially on the template part, but it works). I borrowed the image from Mozilla FireFox

   * The suggestions box is now aligned with the field

* The suggestion highlighting is now optional and disabled by default, to enable it you have to return an option dictionary with highlight = True from the controller. For example: return dict(textItems=[p.Name for p in persons], options=dict(highlight=True))

* A request will only be issued when the text actually changes and not when you press a key that doesn't alter the text (left arrow, right arrow, ctrl, etc)

* When the field loses focus (you pressed tab or clicked somewhere else), the suggestion box is now cleared

   For the future:
- Add a timeout to the requests so if one of them doesn't get answered the spinner won't keep spinning forever - If responses get answered on a different order than they were sent (can happen a lot on connections with lots of packet loss AKA Wi-Fi) the suggestion box would get updated with the wrong results, I think this can be very annoying to the user. We should discard old requests - Add an option to disable the spinner (I didn't do this yet because I didn't figure how to implement it on the template)

Suggestions welcome
--
Claudio Martínez

Reply via email to