Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > giving form input bos focus

Reply
Thread Tools

giving form input bos focus

 
 
new Karoo
Guest
Posts: n/a
 
      07-24-2003
Hi

How do you give an input box in a form focus when the page loads so that you
can just start typing without having to click in the box first.


 
Reply With Quote
 
 
 
 
brucie
Guest
Posts: n/a
 
      07-24-2003
In post <bfpimu$7gs$(E-Mail Removed)>
new Karoo said...

> How do you give an input box in a form focus when the page loads so that you
> can just start typing without having to click in the box first.


this is a bad thing to do. don't bother implementing it. the visitor
may not wait for the page to finish loading before they start filling
out the form so the focus will jump and they may not notice or they
may not all fill the form out in the order you would expect.

i had a host once that did it for the login page. after filling in the
username and half way through the password all of a sudden the focus
would jump back to the username and i would have to start again. it
was very bloody annoying.


--
brucie a. blackford. 25/July/2003 07:32:58 am kilo.
http://loser.brucies.com/
 
Reply With Quote
 
 
 
 
Kris
Guest
Posts: n/a
 
      07-24-2003
In article <(E-Mail Removed)>,
brucie <(E-Mail Removed)> wrote:

> > How do you give an input box in a form focus when the page loads so that you
> > can just start typing without having to click in the box first.

>
> this is a bad thing to do. don't bother implementing it. the visitor
> may not wait for the page to finish loading before they start filling
> out the form so the focus will jump and they may not notice or they
> may not all fill the form out in the order you would expect.
>
> i had a host once that did it for the login page. after filling in the
> username and half way through the password all of a sudden the focus
> would jump back to the username and i would have to start again. it
> was very bloody annoying.


I am taking the opportunity to jump in and propose an alternative to the
OT's suggestion. To me it is clear that he wants the visitor to be able
to focus on the field as quickly as possible.

I suggest putting a TABINDEX attribute on the INPUT, with a value that
enables the user to quickly tab to the field, surpassing any links or
form controls that may be in the way.

For instance,

<input type="text" name="search" tabindex="1">

Another (additional) idea is to set an ACCESSKEY on the field. However,
using accesskeys is not a popular thing, since it is heard of that it
can interfere with existing keyboard shortcuts in some browsers. Yet, as
an illustration,

<input type="text" name="search" tabindex="1" accesskey="s">

To make this key combination visible to the user would be good. This
could be a way of doing that.

<label>Search: (<kbd>s</kbd>) <input type="text" name="search"
tabindex="1" accesskey="s"></label>

Using accesskeys differs between OS's and browsers, but generally a
modifier key is used in combination with the specified key. ALT-s,
OPTION-s or CTRL-s. See which one applies.

--
Kris
http://www.velocityreviews.com/forums/(E-Mail Removed)erlands (nl)
"We called him Tortoise because he taught us" said the Mock Turtle.
 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      07-25-2003
In post <(E-Mail Removed)>
Jacqui or maybePete said...


>>> How do you give an input box in a form focus when the page loads so that you
>>> can just start typing without having to click in the box first.


>> this is a bad thing to do. don't bother implementing it.


> Here's an example page that I think sets focus without those problems:
> http://www.porjes.com/ng/ - comment and criticism welcomeish.


focus moves if i don't start typing straight away when the page is
cached. if i'm fast i can click the field i want and type before focus
moves. i still don't see the point of using it in any case. whats so
wrong with letting the visitor fill the form out how they want instead
of second guessing what the visitor wants?

--
brucie a. blackford. 25/July/2003 07:24:20 pm kilo.
http://loser.brucies.com/
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      07-26-2003
Jacqui or (maybe) Pete <(E-Mail Removed)> wrote:

> Even bloody google does it


Search engine interfaces are rather special. When the _only_ content of
a page is a search form, then a case can be made in favor of automated
initial focus. Even this has some problems though, as Brucie mentioned.
But the real problems begin when people imitate the idea on their own
pages where a form is just a minor ingredient. Automatic initial
focusing implies that tabbing does not start at a reasonable position.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The giving that keeps on giving sixteenmillion C Programming 0 11-19-2007 10:59 PM
this.window.focus() vs. window.focus() vs. this.focus() Roger Javascript 3 03-08-2007 08:53 PM
Vs2005 tool bos is not visible SenthilVel ASP .Net 0 09-09-2006 11:18 AM
Two JS questions in one: giving focus, and clearing form (read inside) ungvichian Javascript 2 05-26-2005 05:36 AM
Giving Focus on PostBack tshad ASP .Net 10 02-28-2005 02:00 AM



Advertisments