title: ExtJS: Login with 'Remember me' functionality
body: <p>I'm trying to create a simple login window with the very common 'Remember me' functionality. The login validation is done AJAX style, thus the browser won't remember my input.</p>
  
  <p>My approach is to use the built-in <code>state</code> functionality, but how to use it confuses me.</p>
  
  <pre><code>Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
      expires: new Date(new Date().getTime()+(1000*60*60*24*7)), //7 days from now
  }));
  
  ...
  
  {
      xtype: 'textfield',
      fieldLabel: 'User name',
      id: 'txt-username',
      stateful: true,
      stateId: 'username'
  }, {
      xtype: 'textfield',
      fieldLabel: 'Password',
      id: 'txt-password',
      inputType: 'password',
      stateful: true,
      stateId: 'password'
  }, {
      xtype: 'button',
      text: 'Validate',
      stateEvents: 'click'
  }
  </code></pre>
  
  <p>I know I have to implement the <code>getState</code> method, but on what component (my guess is on the two textfields)? Another thing I fail to realize is, how is my <strong>click</strong> event on the <em>button</em> connected to the state properties of my <em>textfields</em>?</p>