Posts

Showing posts from May, 2010

Using jQuery to enable keyboard navigation of a survey form that uses radio buttons in ASP.NET

I had been meaning to blog about this for awhile but haven’t had a chance until now. I did some work for my previous employer where the client had a survey form written in ASP.NET, using lots of radio buttons. The radio buttons were generated by a Repeater control. The problem was that these surveys could get quite long and run over many pages. This meant the user would be doing a lot of mouse clicking and could end up getting carpal-tunnel syndrome by the time they were done, which could cause future legal problems! ;-). So the request was to enable some sort of keyboard navigation. As it was a purely client-side issue, it seemed like a perfect opportunity to use jQuery in conjunction with ASP.NET to enable the desired functionality. I figured the most intuitive behavior would be as follows: Give the user a visual clue as to what the “current” radio button is. Use CSS to style the button to put a box around it. Use left, right, up and down a