mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #3013 from silverstripe-iterators/pulls/login-form-js
Prevent IE errors on hidden login forms
This commit is contained in:
commit
25796654ea
@ -114,13 +114,13 @@ class MemberLoginForm extends LoginForm {
|
||||
$this->setValidator(new RequiredFields('Email', 'Password'));
|
||||
|
||||
// Focus on the email input when the page is loaded
|
||||
Requirements::customScript(<<<JS
|
||||
$js = <<<JS
|
||||
(function() {
|
||||
var el = document.getElementById("MemberLoginForm_LoginForm_Email");
|
||||
if(el && el.focus) el.focus();
|
||||
if(el && el.focus && (!jQuery || jQuery(el).is(':visible'))) el.focus();
|
||||
})();
|
||||
JS
|
||||
);
|
||||
JS;
|
||||
Requirements::customScript($js, 'MemberLoginFormFieldFocus');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user