textfield focus question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe McGuckin

    textfield focus question

    I have a text input field with a onChange javascript method.

    I want to type text into the field and hit the return key and have my
    javascript code executed. As is,
    I have to click the mouse somewhere outside the input text field -
    workable but cumbersome.

    Any ideas?


    Thanks,

    Joe
  • kaeli

    #2
    Re: textfield focus question

    In article <248eb73d.04081 71223.3a31c7ee@ posting.google. com>, joe@via.net
    enlightened us with...[color=blue]
    > I have a text input field with a onChange javascript method.
    >
    > I want to type text into the field and hit the return key and have my
    > javascript code executed.[/color]

    But is this what your users want?
    Changing the way a form works is very often a very bad idea. The "return"
    key, or the "enter" key, has certain default behaviors that users get used
    to.

    Assuming it is agreeable to the users (intranet app, personal app, etc),
    you'd need to capture the enter keypress and call your code. The code for
    this has been posted several times. Google the usenet archive.
    Note that this may break the default behavior of having a form submit when
    the user presses the enter key, something some of us really, really like. ;)

    HTH
    --
    --
    ~kaeli~
    Why did kamikaze pilots wear helmets?



    Comment

    Working...