We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17717
    • 433 Posts
    Hi all,

    I have moved the weblogin snippet position at the bottom of the page, when I visit any page it scrolls down to the login form which I don’t want to do.

    The obvious solution was to remove tabindex from the code, that didn’t seem to work, here is the chunk I used (taken from the default modx installation):

    <!-- #declare:separator <hr> --> 
    <!-- login form section-->
    <form method="post" name="loginfrm" action="[+action+]"> 
        <input type="hidden" value="[+rememberme+]" name="rememberme" /> 
        <fieldset>
            <h3>Your Login Details</h3>
            <label for="username">User: <input type="text" name="username" id="username" onkeypress="return webLoginEnter(document.loginfrm.password);" value="[+username+]" /></label>
        	<label for="password">Password: <input type="password" name="password" id="password" onkeypress="return webLoginEnter(document.loginfrm.cmdweblogin);" value="" /></label>
        	<input type="checkbox" id="checkbox_1" name="checkbox_1" size="1" value="" [+checkbox+] onclick="webLoginCheckRemember()" /><label for="checkbox_1" class="checkbox">Remember me</label>
        	<input type="submit" value="[+logintext+]" name="cmdweblogin" class="button" />
    	<a href="#" onclick="webLoginShowForm(2);return false;" id="forgotpsswd">Forget Your Password?</a>
    	</fieldset>
    </form>
    <hr>
    <!-- log out hyperlink section -->
    <h4>You're already logged in</h4>
    Do you wish to <a href="[+action+]" class="button">[+logouttext+]</a>?
    <hr>
    <!-- Password reminder form section -->
    <form name="loginreminder" method="post" action="[+action+]">
        <fieldset>
            <h3>It happens to everyone...</h3>
            <input type="hidden" name="txtpwdrem" value="0" />
            <label for="txtwebemail">Enter the email address of your account to reset your password: <input type="text" name="txtwebemail" id="txtwebemail" size="24" /></label>
            <label>To return to the login form, press the cancel button.</label>
        	<input type="submit" value="Submit" name="cmdweblogin" class="button" /> <input type="reset" value="Cancel" name="cmdcancel" onclick="webLoginShowForm(1);" class="button" style="clear:none;display:inline" />
        </fieldset>
    </form>


    Can anyone let me know what might be causing it to carry on moving down?

    Thanks
    Lee
      http://www.blend.uk.com | Web Design by Blend
      • 29181
      • 480 Posts
      Hi,
      have you tried adding a tabindex of 1 to something at the top of the page? Maybe that would solve it. I presume it is targetting that because it’s the only textfield, but maybe you could add the tabindex to an image or something like that.

        Adrian Lawley: www.adrianlawley.com
        • 17717
        • 433 Posts
        That will most likely confuse things like screen readers though, might be a good workaround for now though until I figure it out.

        Thanks
        Lee
          http://www.blend.uk.com | Web Design by Blend
          • 17717
          • 433 Posts
          No, didn’t seem to fix it that.
            http://www.blend.uk.com | Web Design by Blend
            • 31037
            • 358 Posts
            If I remember correctly there is a piece of javascript in the web login snippet that sets focus to the login in form. If so, try to disable that piece of code in the snippet.

            Not sure thought...
              • 4041
              • 788 Posts
              Look in assets/snippets/weblogin/weblogin.inc.php

              find the following code:(lines 87 - 89)

              <script type="text/javascript">
                if (document.loginfrm) <?php echo !empty($uid) ? "document.loginfrm.password.focus()" : "document.loginfrm.username.focus()" ?>;
              </script>
              


              disable it or remove it completely smiley
                xforum
                http://frsbuilders.net (under construction) forum for evolution
                • 26435
                • 1,193 Posts
                Exactly right breezer.
                This code relic needs to die ASAP. I believe that inline JavaScript and CSS should be kept out of snippets and left to user created templates and templating chunks. Although forcing focus to a text input may be situationally useful, for many users, undoing this is going to cause nothing but confusion.

                A user should be able to edit a chunk or TV to focus or blur a text input, but digging through code in files on their servers? (weblogin.inc.php?). That just sounds like either a really bad idea or a good way to break something.

                -sD-
                Dr. Scotty Delicious, Scientist.
                  Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
                  All of the above... in no specific order.


                  I send pointless little messages