mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-01 05:39:10 +02:00
Merge pull request #2314 from mateusz/required-attrs
HTML5 required attributes on default fields, add validator to the login form
This commit is contained in:
commit
351c1168b6
@ -360,6 +360,11 @@ class FormField extends RequestHandler {
|
|||||||
'disabled' => $this->isDisabled(),
|
'disabled' => $this->isDisabled(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->Required()) {
|
||||||
|
$attrs['required'] = 'required';
|
||||||
|
$attrs['aria-required'] = 'true';
|
||||||
|
}
|
||||||
|
|
||||||
return array_merge($attrs, $this->attributes);
|
return array_merge($attrs, $this->attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +94,8 @@ class MemberLoginForm extends LoginForm {
|
|||||||
|
|
||||||
parent::__construct($controller, $name, $fields, $actions);
|
parent::__construct($controller, $name, $fields, $actions);
|
||||||
|
|
||||||
|
$this->setValidator(new RequiredFields('Email', 'Password'));
|
||||||
|
|
||||||
// Focus on the email input when the page is loaded
|
// Focus on the email input when the page is loaded
|
||||||
Requirements::customScript(<<<JS
|
Requirements::customScript(<<<JS
|
||||||
(function() {
|
(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user