views:

11

answers:

0

I need a better solution for auto-completion when the values being auto-completed are file names. I have an application that requires the user to input the name of a file (to be fed to a static analysis engine based on Perl::Critic, in case anyone is curious). File-upload isn't an option for a couple of reasons, the main one being that I need the full path so that I can interact with a version-control repository and file-upload doesn't preserve the full path name (for security reasons).

I am familiar with the current basic Autocomplete plugin for jQuery UI. At present I am using this plugin. However, scanning the filesystem to generate the data that seeds the autocomplete functionality can take 10-20 seconds because of the size of the source repository being examined. What I would like is something more akin to what a file-browser widget does when you're typing in the name of the file rather than mousing through the tree. That is, when the current value in the input field is /user/rjray/, the auto-complete options are just the contents of that directory. When I hit tab on a selection, it completes it and if the result is still a directory, refreshes the auto-complete list. And so on, the behavior one generally expects from a "File->Open File..." menu dialog.

If this is doable with the jQuery UI Autocomplete plugin, I haven't been able to get it to work. I mostly get hung up on the behavior of tab and enter, which don't seem to act the way you would expect them to in this case.