giving form input bos focus

Discussion in 'HTML' started by new Karoo, Jul 24, 2003.

  1. new Karoo

    new Karoo Guest

    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.
    new Karoo, Jul 24, 2003
    #1
    1. Advertising

  2. new Karoo

    brucie Guest

    In post <bfpimu$7gs$>
    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/
    brucie, Jul 24, 2003
    #2
    1. Advertising

  3. new Karoo

    Kris Guest

    In article <>,
    brucie <> 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
    erlands (nl)
    "We called him Tortoise because he taught us" said the Mock Turtle.
    Kris, Jul 24, 2003
    #3
  4. new Karoo

    brucie Guest

    In post <>
    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/
    brucie, Jul 25, 2003
    #4
  5. Jacqui or (maybe) Pete <> 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
    Jukka K. Korpela, Jul 26, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad

    Giving Focus on PostBack

    tshad, Feb 15, 2005, in forum: ASP .Net
    Replies:
    10
    Views:
    741
    Joshua Flanagan
    Feb 28, 2005
  2. SenthilVel

    Vs2005 tool bos is not visible

    SenthilVel, Sep 9, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    381
    SenthilVel
    Sep 9, 2006
  3. sixteenmillion

    The giving that keeps on giving

    sixteenmillion, Nov 19, 2007, in forum: C Programming
    Replies:
    0
    Views:
    418
    sixteenmillion
    Nov 19, 2007
  4. ungvichian
    Replies:
    2
    Views:
    150
  5. Roger
    Replies:
    3
    Views:
    310
Loading...

Share This Page