setName('form_login'); $this->addElement('text', 'username', array( 'label' => t('Username'), 'placeholder' => t('Please enter your username...'), 'required' => true, )); $this->addElement('password', 'password', array( 'label' => t('Password'), 'placeholder' => t('...and your password'), 'required' => true )); // TODO: We need a place to intercept filled forms before rendering if ($this->getRequest()->getPost('username') !== null) { $this->getElement('password')->setAttrib('class', 'autofocus'); } else { $this->getElement('username')->setAttrib('class', 'autofocus'); } $this->setSubmitLabel('Login'); } }