« Layering Flex over AJAX and collaborating with data services -- whoa! | Main | AS3 technique -- using object instances as "enums" »
April 3, 2006
Flex auto complete text input control v0.6
Here is a new version of the auto complete text input control, which is a cross between Google suggest, the "save information I typed in forms" preference found in browsers, and the HTML <select> control.
If you provide a static list of items to the control, the control can do the filtering. Alternatively, you can create a function to give suggestions (which is necessary if you are doing the filtering on the server).
As before, there is a "mustSelect" flag which turns the control into a sort of super version of the HTML <select> tag. The main benefit to using this instead of <select> is that using the keyboard to narrow down your choices is much easier.
Finally, I added the ability to automatically save form data as local storage and provide hints based on this data. This makes it behave similarly to HTML text fields in most browsers.
Unlike how browsers work (so far...) you can individually delete these hints. I hate it when I mistype something into a field and I get a hint for that typo every time I visit the app! With these controls, you can right mouse on any of the hints you don't like and delete them.
NOTE: Flex beta 2 is REQUIRED for viewing or using this control.
[Sample -- Simple form using CompletionInput]
[Source code]
Known issues:
- Saved form data is never automatically removed, which may eventually lead to running out of shared object space. The user can always manually delete the saved form data using the right mouse
- When you navigate through the hints, keyboard events continue to propagate to the control. So, for example, if you hit the up arrow while the hints are showing, the selection in the hint menu will move up one, and the insertion point in the text field will move all the way to the beginning of the control. This is due to a player limitation, and I am still struggling to find a good workaround.
- Sometimes, when using the "keepLocalHistory" feature, you will find multiple versions of the same string in your history. I am 95% positive it is just a programming error on my part, but I can't track it down. (help?)
- Hints don't reposition themselves if the control moves while the hint is visible.
- A scrollbar appears in the hint dropdown even when not needed.
- Do not use this for password fields! I have never actually tried it, but I bet you can get it to show you a popup that lists the last few passwords you've typed... Probably not what you want, security-wise!
Let me know what you think. And if you find any bugs, please let me know (especially if you have a fix!!)
Posted by sho at April 3, 2006 10:41 AM