Jump to:

794 Posts in 408 Topics by 304 members

Widgets

SilverStripe Forums » Widgets » Login widget auto focus on email field, help!

Discuss SilverStripe Widgets.

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

Page: 1
Go to End
Author Topic: 1391 Views
  • BrysaniStudios
    Avatar
    Community Member
    12 Posts

    Login widget auto focus on email field, help! Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: Login widget auto focus on email field, help! Link to this post

    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.

  • BrysaniStudios
    Avatar
    Community Member
    12 Posts

    Re: Login widget auto focus on email field, help! Link to this post

    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.

    1391 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.