web development

Fixing the Enter Key on AHAH Forms

Update: I've modified the suggested JavaScript code to not break #autocomplete enter presses.

The #ahah element introduced in Drupal 6 makes setting up dynamic JavaScript-driven forms much simpler than with Drupal 5. To see this in action, take a look at the Poll module. When adding more choices to a form, clicking the "Add another choice" button doesn't reload the page if JavaScript is enabled. However, there is one problem with such a form: by adding a submit button above other submit elements, it becomes the default action when pressing the enter key. Unfortunately, browsers don't have a method to specify the default submit action, and usually just use the first submit element on the form. To see this issue, try pressing the enter key inside the Title field on a Poll node. The page reloads, and the JS-disabled fallback is executed, instead of the Preview action as may be expected.

This might be behaving as intended with the Poll module, but I wanted to ensure that the enter key action was consistent with a similar feature I was adding to the Skeleton Outline module. Most JavaScript code online will recommend doing something similar to the following:

Deploy Drupal Modules and Themes with Eclipse External Tools

Eclipse, with the newly released PDT 2.0, is a very capable Drupal IDE. With code completion, automatic documentation lookups, and integrated debugging, Eclipse is very good for anyone who spends time doing Drupal code.

One issue I've run into with Eclipse when working on contributed modules is that the modules themselves aren't located within a Drupal installation. I found myself resorting to external programs or the command line to copy my changes to my development site or to my local development copy. Using Eclipse's External Tools, it's possible to deploy changes with a single click, greatly reducing the time to test modified code.

Open Firefox Page in Safari

I do most of my website development work in Firefox, due to the availability of extensions such as Firebug, YSlow, and Tamper. Sometimes, I want to check a page in another browser so I can log in as a different user. This simple Applescript, combined with Quicksilver, allow me to easily open the current Firefox page in Safari:

tell application "Minefield" to set theURL to «class curl» of window 1
tell application "Safari"
open location theURL
end tell

Running Microsoft's IE Application Compatibility Images in VirtualBox

Update: Unfortunately, as of the September 2009 release, the VPC images from Microsoft have been changed and are now a bit more picky about activation. When you follow this procedure, the images will now fail activation. I've left this page up so that the procedure can be tried on future releases of the images.

Virtualbox is a virtualization product produced by Sun. Available for Windows, Linux, OS X, and Solaris, it not only is fast and full of features, but free! Most of the product is available under the GPL. Some additional features, such as USB and Remote Desktop support, are available free of charge for personal and small-scale commercial use.

Unfortunately, Virtualbox doesn't come with a robust set of tools to convert disk images. While you can convert images between Virtualbox (VDI) and VMWare (VMDK), as well as from straight raw disk images, you can't easily convert images from Microsoft's VirtualPC format. This is an issue when you want to use Microsoft's free VPC images for testing various versions of Internet Explorer. Luckily, with a little bit of help from QEMU, it's possible to convert these images into something usable, all without needing a copy of Windows installed to bootstrap everything.

The Future of Internet Explorer is Firefox

If you do any website development, and have ever experienced a compatibility issue with Internet Explorer, then this article will be interesting to you. Mozilla is working on getting both the canvas element and Tamarin supported natively in Internet Explorer through ActiveX controls. While the Ars Technica article doubts that many will install such plugins, a few big backers, such as Adobe or Google could make a major change in the web browser landscape. Imagine if the Google Toolbar came bundled with additional controls to fix IE's broken CSS, add support for tags and selectors Microsoft decided not to implement, and speed up Google Maps to boot (by avoiding the ExCanvas library). Exciting work!

Syndicate content