Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Widgets /

Discuss SilverStripe Widgets.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Login widget auto focus on email field, help!


Go to End


3 Posts   2654 Views

Avatar
BrysaniStudios

Community Member, 12 Posts

1 May 2010 at 7:40am

I implemented a login widget on this site I'm working on and I noticed that if the login widget is below the fold, when the page loads it automatically scrolls down the page so the email field can be visible. It's quite annoying, it seems that some javascript is getting added to the bottom of the page, but I can't seem to find where its coming from. I've. Looked through tons of files to see where its getting added in, but no luck. Need help please.

Avatar
Willr

Forum Moderator, 5523 Posts

1 May 2010 at 9:48pm

This focus is probably coming from MemberLoginForm.php. Has something like

Requirements::customScript(<<<JS
	(function() {
	var el = document.getElementById("MemberLoginForm_LoginForm_Email");
	if(el && el.focus) el.focus(); 
	})();
JS
);

Which looks like it would focus it. Only way to disable that it looks like is setting the javascript validation handler to none.

Avatar
BrysaniStudios

Community Member, 12 Posts

2 May 2010 at 7:20am

OMG, they really hid that, I've been looking for that file FOREVER!
I had to do a search of entire local site in dreamweaver. Its in sapphire/security/MemberLoginForm.php
I can just comment that out, right?

Thanks Man!
REally Appreciate it.