Auto-focus submit button in the confirm removal form
This commit is contained in:
parent
8a17cc5161
commit
0e4b9f1672
|
@ -11,11 +11,26 @@ use Icinga\Web\Form;
|
|||
class ConfirmRemovalForm extends Form
|
||||
{
|
||||
/**
|
||||
* Initialize this form
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->setName('form_confirm_removal');
|
||||
$this->getSubmitLabel() ?: $this->setSubmitLabel($this->translate('Confirm Removal'));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addSubmitButton()
|
||||
{
|
||||
parent::addSubmitButton();
|
||||
|
||||
if (($submit = $this->getElement('btn_submit')) !== null) {
|
||||
$class = $submit->getAttrib('class');
|
||||
$submit->setAttrib('class', empty($class) ? 'autofocus' : $class . ' autofocus');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue