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.

Widgets /

Discuss SilverStripe Widgets.

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

Login widget auto focus on email field, help!


Reply


3 Posts   1477 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, 5513 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.