mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX #3418: Remove jQuery coupling from Email field focus, and only include email focus when validation is enabled
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@72557 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9919f5383e
commit
4e28b8d865
@ -37,15 +37,6 @@ class MemberLoginForm extends LoginForm {
|
||||
Requirements::css($customCSS);
|
||||
}
|
||||
|
||||
// Focus on the email input when the page is loaded
|
||||
Requirements::customScript("
|
||||
(function($){
|
||||
$(document).ready(function() {
|
||||
$('#Email input').focus();
|
||||
});
|
||||
})(jQuery);
|
||||
");
|
||||
|
||||
if(isset($_REQUEST['BackURL'])) {
|
||||
$backURL = $_REQUEST['BackURL'];
|
||||
} else {
|
||||
@ -85,6 +76,18 @@ class MemberLoginForm extends LoginForm {
|
||||
}
|
||||
|
||||
parent::__construct($controller, $name, $fields, $actions);
|
||||
|
||||
// Focus on the email input when the page is loaded
|
||||
// Only include this if other form JS validation is enabled
|
||||
if($this->getValidator()->getJavascriptValidationHandler() != 'none') {
|
||||
Requirements::customScript(<<<JS
|
||||
(function() {
|
||||
var el = document.getElementById("MemberLoginForm_LoginForm_Email");
|
||||
if(el && el.focus) el.focus();
|
||||
})();
|
||||
JS
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user