crysfel/Bleextop — Issue #12: Login autofocus
Author: joel-e
Created: 2011-12-13 17:40:29+00:00
State: open

Here is the way I've added autofocus for the username field at login:

https://github.com/crysfel/Bleextop/blob/master/js/Bleext/modules/login/LoginForm.js#L41

```javascript
items	: [{
labelAlign	: "top",
msgTarget	: 'side',
fieldLabel	: "User",
name	: "username",
allowBlank	: false,
flex	: 1,
margins	: {right:3},
listeners: {
render: function(f) {
f.findParentByType('window').defaultButton = f;
}
}
},{
```

See: [Sencha forum post](http://www.sencha.com/forum/showthread.php?100873-Auto-focus-field-in-form-%28race-conditions-in-events-%29&p=473907&viewfull=1#post473907)