A Couple of Random Head-Bangers

There are equal parts science and art to what we technologists do. Today was not an art day. Two quick notes while I’m still pissed.

First, if you are trying to run a Java app on Windows 7 under VirtualBox and you enabled the experimental 3D video driver stuff, you will be disappointed. I must have smashed my face into my monitor for two hours trying to figure this out. I went up and down JRE versions, hulk-smashing any left-over bits from the registry after uninstalls, and still no dice. Unchecking the 3D bit in Virtualbox did it. Our office’s VPN client is Java. Because, you know… no good reason.

Second, there has been a long running feature/bug in jQuery UI’s Autocomplete control. For modern browsers, you can scroll through the suggestion list with arrow keys and hit Enter on your keyboard. OldIE (<9) does a big fat nothing when you hit enter, making you grab your mouse and click the result. Because, you know… no good reason.

I was working on some theme upgrades to our GeoPortal site and decided I was going to get that crap squared away. I also wanted it to automatically select if there’s only one result. I had tried various hacks to get this working on oldIE to no avail, but this time I bellied up to my bar standing desk and refused to move until something gave.

That was a really long stand. I won’t go through the gaggles of Googling and failed attempts. A sailor walking by my window heard me swearing and was stricken dead. His parents died two states over. But this is the open event bit you need in your Autocomplete function.


open: function(event, ui) {
/* enter or right arrow key */
if (e.keyCode == 13 || e.keyCode == 39) {
if ($("ul.ui-autocomplete li.ui-menu-item").length == 1) {

Basically we’re sitting on the Autocomplete open function, telling it to monitor keypresses for a Enter or right arrow key. If that happens, it triggers the active element click (simulating a mouse click), and the select function fires correctly, even under oldIE. The next if/then finds the number of search results, and if there is only 1, it goes ahead and fires the select function on it (autoFocus: true required). GAAAA MY BRAINS! After I figured that out I had a powerful urge to turn on some Meshuggah and write poetry about death.

And that ate most of my day. Now I’m watching my latest happy video to baseline before I go back on daddy duty.