But when I use the tab key to change focus then the focus jumps from LastName to Password. The CoutryCode is focused after Birthday. Seems to be wrong…
You can set the tab indexes in the FieldFactory using Field.setTabIndex(int). By default the browser uses the order in which the elements appear in the DOM and the GridLayout used in the sample first renders single-cell components and then multi-cell components (country code) which causes the tab to jump between the fields in that order.
Did you ever get this to work? I’m having the exact same problem with Vaadin 6.4.6. I use attachField to place fields within a GridLayout and I call setTabIndex (1-based) on the fields just after data is bound to the form. The tab order is wrong and also I cannot get the proper field to have the initial focus. Seems to work fine in “simple” forms.
I don’t see it working with GridLayout either. You’d think the default for a GridLayout would left to right, top to bottom, like regular HTML. Not sure what it’s doing, but it doesn’t tab nicely through a Form as you’d expect.
In HTML, I’ve only had to set the tab index when I want it to take a different order than the page is laid out (left to right, top to bottom), such as a 2-column table in which I want to go down the first column, then down the second column.