MonoRail - Efficient Tab Indexing

I'm a big fan of keyboard shortcuts for the Windows, Resharper, Firefox, Web Browsing, GMail, etc.  The less I touch the mouse the more productive I am.  One thing that can make a great web application suck hard is poor or absent tab indexing on form fields.  It takes a little extra time on the developers part but it makes a world of difference to the end user.  Rather than hard code tabIndexes, I use the following technique using a simple accumulator:

<?brail
  tabIndex = 1
?>

${Form.FormTag({'action':'login'})}
<table>
  <tr>
    <td>${Form.LabelFor('username', 'Username')}</td>
    <td>
      ${Form.TextField('username', {'tabIndex':tabIndex++})}
    </td>
  </tr>
  <tr>
    <td>${Form.LabelFor('password', 'Password')}</td>
    <td>${Form.PasswordField('password', {'tabIndex':tabIndex++})}</td>
  </tr>
  <tr>
    <td />
    <td>${Form.Submit('Login', {'tabIndex':tabIndex++})}</td>
  </tr>
</table>
${Form.EndFormTag()}

One problem I struggled with in ASP.Net was allowing tabIndexes to properly flow from a page to a user control then back again.  I'm going to ping Oren to see if it is possible to declare tabIndex 'globally' (in a layout maybe?) and allow all views/sub views/view components to use the same value to try and address this in MonoRail.

posted @ Tuesday, June 26, 2007 11:13 PM


Print

Comments on this entry:

# re: MonoRail - Efficient Tab Indexing

Left by Ayende Rahien at 6/27/2007 1:30 AM
Gravatar

Brail maintain separation between views, so you can use "list" in one view, and be able to use it in another without affect the first view.<br />This is a good suggestion, however...<br />Probably something like:<br />VisibleToAllViews("tabIndex") that would make this visible to all the views

# re: MonoRail - Efficient Tab Indexing

Left by Christopher Bennage at 6/27/2007 4:32 PM
Gravatar

I enjoy these pragmatic posts on MonoRail. Keep them coming.

Your comment:



 (will not be displayed)


 
 
 
Please add 5 and 2 and type the answer here:
 

Live Comment Preview:

 
«August»
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456