Archive for the ‘Programming’ Category

jQuery Tip: Radio Button Deselection

As a web developer I sometimes get things thrown at us that for whatever reason it makes sense for the behaviour of something to be changed. Normally I push back in these situations waving the big User Experience stick at people, but sometimes the request actually makes sense.

Recently while working on a survey page for a client that was entirely radio button driven I was asked for the ability to allow a user to de-select a radio button – I assumed it would be a pretty easy task, but was wrong. The answers Google returned for me mostly said “radio buttons should always have a value, they aren’t designed for de-selection.”

The problem with this particular set of buttons was it was the weighting in the survey the user assigned to the ‘Other’ field. If the user selected a radio button they were then forced to have to enter their own text with no way of deciding the no longer wanted to enter an optional “other” item. This was also the only optional field in the entire survey. The other problem was purely aesthetic with a “no selection” selection not working with the design. It was decided a second click on the radio button would de-select the selection.

I thought it would be easy – I’ll just cancel the onClick event on that object. Unfortunately Firefox didn’t like that idea. It seems that when the onClick event is fired, the radio button is already selected, so retrieving the previous selection’s value didn’t work. The way I dealt with this was a two-pronged approach using both the mouseDown and click events.

Zend Amazon S3 conflicting with Twitter

I’ve recently been working on the backend for a project which revealed a conflict between Zend_Service_Amazon_S3 and Zend_Service_Twitter.

Using irssi with libnotify over Secure Shell

I found some irssi plugins for people running irssi locally to integrate with libnotify, but all the solutions by people for doing this remotely involved re-establishing ssh connections for each message and various other overheads that I was not comfortable with. The solution was obvious, to me – ssh needed dbus forwarding support. Well I don’t have the time nor experiece with the ssh code base to do it, a workaround was needed.