How to submit form with <enter>?

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

    #1

    How to submit form with <enter>?

    I have a text area form object. A user clicks a send button and the text
    area information is submitted. How can I also allow the information to be
    submitted after the user hits the <enter> key?

    Thanks,
    Brett


  • Lasse Reichstein Nielsen

    #2
    Re: How to submit form with &lt;enter&gt ;?

    "Brett" <myaccount@cyge n.com> writes:
    [color=blue]
    > I have a text area form object. A user clicks a send button and the text
    > area information is submitted. How can I also allow the information to be
    > submitted after the user hits the <enter> key?[/color]

    If you do that, he can only enter one line of text. Then you can just
    use an <input type="text"> instead of a text area. It automatically
    submits when you press return.

    If you insist on using a script:

    <textarea onkeypress="if (event.keyCode == 13) {this.form.subm it();}">

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Fabian

      #3
      Re: How to submit form with &lt;enter&gt ;?

      Brett hu kiteb:
      [color=blue]
      > I have a text area form object. A user clicks a send button and the
      > text area information is submitted. How can I also allow the
      > information to be submitted after the user hits the <enter> key?
      >[/color]
      usea normal text field instead of a textarea field. It should then
      submit as a default action when enter is pressed.


      --
      --
      Fabian
      Visit my website often and for long periods!


      Comment

      Working...