Comfortable focus setting on login mask

* Needs improvement once we have better forms
This commit is contained in:
Thomas Gelf 2014-03-04 10:56:12 +00:00
parent 715cad86d5
commit 29f007e537
1 changed files with 7 additions and 3 deletions

View File

@ -54,9 +54,7 @@ class LoginForm extends Form
array(
'required' => true,
'placeholder' => t('Username'),
'class' => 'autofocus'
)
);
$this->addElement(
@ -67,7 +65,13 @@ class LoginForm extends Form
'required' => true
)
);
$user = $this->getElement('username');
// TODO: We need a place to intercept filled forms before rendering
if (isset($_POST['username'])) {
$this->getElement('password')->setAttrib('class', 'autofocus');
} else {
$user->setAttrib('class', 'autofocus');
}
$this->setSubmitLabel('Login');
}