Thing learned for the day

I’m sure this is well known already, but it was a new one on me.

I have a web form that has a tabular layout of fields. But at the end of each row is a field that mustn’t ever get focus (for reasons that are to boring to go into), so I have an onFocus Javascript event in those fields that immediately blurs the focus if the user tries to get into it. All fine and dandy until you try and tab your way around the table, when you reach the end of each row, we end up with no field having focus.

The thing I learned (was told by an exasperated web designer) is that you can set the “tabindex” of a field to -1. If you do this then it is effectively excluded from the tab order of the form as you use the keyboard to navigate around.

Cue much punching of the sky as we knock another bug off the list for the application I’m working on at the moment. It’s the little victories that count!