Automatic focus on username field when logging in

Suggestions or questions relating to The Greenhouse

Moderator: GH Moderators

Post Reply
User avatar
zim
Steve Walters
Posts: 7000
Joined: July 8, 2015, 3:38 pm
Favourite Player: Past: Brett Mullins
Present: Elliot Whitehead
Location: Sydney

Automatic focus on username field when logging in

Post by zim » August 6, 2015, 12:07 pm

Please can you update your function that runs when logging in that automatically focusses the username field.
It runs on window load so by then I've already filled out the username and am halfway through my password before it flicks the cursor back to the username field.

This point would be moot if it automatically logged me in each time but it never remembers to.

The function is:

Code: Select all

onload_functions.push('document.getElementById("username").focus();');
It needs to be updated to:

Code: Select all

function someFunction(){
    var elemUsername = document.getElementById("username");
    
    if(elemUsername.value === ''){
        elemUsername.focus();
    }
}


onload_functions.push(someFunction);
Or if you need it in a string on one line:

Code: Select all

onload_functions.push('var elemUsername = document.getElementById("username"); if(elemUsername.value === "")elemUsername.focus();')

User avatar
greeneyed
Don Furner
Posts: 127877
Joined: January 7, 2005, 4:21 pm

Re: Automatic focus on username field when logging in

Post by greeneyed » August 6, 2015, 1:51 pm

Maybe Skeepe can help. If you're having trouble staying logged in, however, bookmark this URL and log in via this URL: index.php
Image

The Nickman
Mal Meninga
Posts: 44294
Joined: June 25, 2012, 9:53 am
Favourite Player: Hodgo
Location: Rockhampton, Central Queensland

Re: Automatic focus on username field when logging in

Post by The Nickman » August 6, 2015, 2:15 pm

Good grief, sort it out, Skeepe
Image
2012 Golden Boogs Newbie of the Year
2013 'Nella Awards Best Punter
2013 Boogs Thread of the Year ~ The Betting Thread
2014 Boogs Matthew Elliott Award Winner
2014 Boogs some award with Hanbush

User avatar
zim
Steve Walters
Posts: 7000
Joined: July 8, 2015, 3:38 pm
Favourite Player: Past: Brett Mullins
Present: Elliot Whitehead
Location: Sydney

Re: Automatic focus on username field when logging in

Post by zim » August 6, 2015, 2:18 pm

greeneyed wrote:Maybe Skeepe can help. If you're having trouble staying logged in, however, bookmark this URL and log in via this URL: index.php
Thanks. I'd never even noticed that login form at the bottom of the page.

The Nickman
Mal Meninga
Posts: 44294
Joined: June 25, 2012, 9:53 am
Favourite Player: Hodgo
Location: Rockhampton, Central Queensland

Re: Automatic focus on username field when logging in

Post by The Nickman » August 6, 2015, 2:20 pm

Good grief zim, sort it out
Image
2012 Golden Boogs Newbie of the Year
2013 'Nella Awards Best Punter
2013 Boogs Thread of the Year ~ The Betting Thread
2014 Boogs Matthew Elliott Award Winner
2014 Boogs some award with Hanbush

User avatar
reptar
Laurie Daley
Posts: 14646
Joined: January 25, 2005, 9:24 pm
Favourite Player: Josh Hodgson
Location: Brisbane

Re: Automatic focus on username field when logging in

Post by reptar » August 6, 2015, 2:23 pm

I loathe JavaScript. I hope this helps.
Gina Riley: Oh, come on, John. That’s a bit old hat, the corrupt IOC delegate.
John Clarke: Old hat? Gina, in the scientific world when they see that something is happening again and again and again, repeatedly, they don’t call it old hat. They call it a pattern.

Shadow Boxer
Ricky Stuart
Posts: 9176
Joined: May 20, 2008, 2:50 pm

Re: Automatic focus on username field when logging in

Post by Shadow Boxer » August 6, 2015, 2:27 pm

Want a job ?
Image

User avatar
zim
Steve Walters
Posts: 7000
Joined: July 8, 2015, 3:38 pm
Favourite Player: Past: Brett Mullins
Present: Elliot Whitehead
Location: Sydney

Re: Automatic focus on username field when logging in

Post by zim » August 6, 2015, 3:23 pm

Shadow Boxer wrote:Want a job ?
Is that directed at me?

Shadow Boxer
Ricky Stuart
Posts: 9176
Joined: May 20, 2008, 2:50 pm

Re: Automatic focus on username field when logging in

Post by Shadow Boxer » August 6, 2015, 3:39 pm

haha, could be, I have Sitecore CMS, .Net and javascript guys in a team. some of them loathe JS as well,

Public service though mate so its not that simple.
Image

User avatar
zim
Steve Walters
Posts: 7000
Joined: July 8, 2015, 3:38 pm
Favourite Player: Past: Brett Mullins
Present: Elliot Whitehead
Location: Sydney

Re: Automatic focus on username field when logging in

Post by zim » August 6, 2015, 3:53 pm

Shadow Boxer wrote:haha, could be, I have Sitecore CMS, .Net and javascript guys in a team. some of them loathe JS as well,

Public service though mate so its not that simple.
I write JS for a living. I have a fulltime job at the moment though.
If it's like contract work or something that a fulltime worker can do on the side chuck me a PM with the deets.

Shadow Boxer
Ricky Stuart
Posts: 9176
Joined: May 20, 2008, 2:50 pm

Re: Automatic focus on username field when logging in

Post by Shadow Boxer » August 6, 2015, 7:05 pm

Will do mate
Image

The Nickman
Mal Meninga
Posts: 44294
Joined: June 25, 2012, 9:53 am
Favourite Player: Hodgo
Location: Rockhampton, Central Queensland

Re: Automatic focus on username field when logging in

Post by The Nickman » August 6, 2015, 7:06 pm

Hahahaha classic zim
Image
2012 Golden Boogs Newbie of the Year
2013 'Nella Awards Best Punter
2013 Boogs Thread of the Year ~ The Betting Thread
2014 Boogs Matthew Elliott Award Winner
2014 Boogs some award with Hanbush

User avatar
greeneyed
Don Furner
Posts: 127877
Joined: January 7, 2005, 4:21 pm

Re: Automatic focus on username field when logging in

Post by greeneyed » August 6, 2015, 7:06 pm

Sim, we might have to make you the new Skeepe! ;)
Image

The Nickman
Mal Meninga
Posts: 44294
Joined: June 25, 2012, 9:53 am
Favourite Player: Hodgo
Location: Rockhampton, Central Queensland

Re: Automatic focus on username field when logging in

Post by The Nickman » August 6, 2015, 7:08 pm

greeneyed wrote:Sim, we might have to make you the new Skeepe! ;)
Jesus, GE, you could at least get his name right when you're offering him Skeepe's job!!
Image
2012 Golden Boogs Newbie of the Year
2013 'Nella Awards Best Punter
2013 Boogs Thread of the Year ~ The Betting Thread
2014 Boogs Matthew Elliott Award Winner
2014 Boogs some award with Hanbush

User avatar
greeneyed
Don Furner
Posts: 127877
Joined: January 7, 2005, 4:21 pm

Re: Automatic focus on username field when logging in

Post by greeneyed » August 6, 2015, 7:27 pm

It auto corrected.
Image

Wayne
Sam Backo
Posts: 176
Joined: June 25, 2015, 12:55 pm

Re: Automatic focus on username field when logging in

Post by Wayne » August 8, 2015, 9:16 pm

zim wrote:Please can you update your function that runs when logging in that automatically focusses the username field.
It runs on window load so by then I've already filled out the username and am halfway through my password before it flicks the cursor back to the username field.

This point would be moot if it automatically logged me in each time but it never remembers to.

The function is:

Code: Select all

onload_functions.push('document.getElementById("username").focus();');
It needs to be updated to:

Code: Select all

function someFunction(){
    var elemUsername = document.getElementById("username");
    
    if(elemUsername.value === ''){
        elemUsername.focus();
    }
}


onload_functions.push(someFunction);
Or if you need it in a string on one line:

Code: Select all

onload_functions.push('var elemUsername = document.getElementById("username"); if(elemUsername.value === "")elemUsername.focus();')
You sound like the life of any party.

The Nickman
Mal Meninga
Posts: 44294
Joined: June 25, 2012, 9:53 am
Favourite Player: Hodgo
Location: Rockhampton, Central Queensland

Re: Automatic focus on username field when logging in

Post by The Nickman » August 9, 2015, 3:04 pm

Classic Steinberger
Image
2012 Golden Boogs Newbie of the Year
2013 'Nella Awards Best Punter
2013 Boogs Thread of the Year ~ The Betting Thread
2014 Boogs Matthew Elliott Award Winner
2014 Boogs some award with Hanbush

User avatar
zim
Steve Walters
Posts: 7000
Joined: July 8, 2015, 3:38 pm
Favourite Player: Past: Brett Mullins
Present: Elliot Whitehead
Location: Sydney

Re: Automatic focus on username field when logging in

Post by zim » August 10, 2015, 8:25 am

Jeff Steinberger wrote:You sound like the life of any party.
Someone never left high school.

User avatar
Manchild
Jason Croker
Posts: 4846
Joined: September 28, 2011, 11:29 am
Favourite Player: Past: Brad Clyde
Present: Shaun Fensom
Location: Darwin, NT

Re: Automatic focus on username field when logging in

Post by Manchild » August 11, 2015, 10:50 am

zim wrote:
Jeff Steinberger wrote:You sound like the life of any party.
Someone never left high school.
Image

Post Reply