Merge pull request #3013 from silverstripe-iterators/pulls/login-form-js

Prevent IE errors on hidden login forms
This commit is contained in:
Damian Mooyman 2014-04-09 17:45:33 +12:00
commit 25796654ea

View File

@ -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');
}
/**