why does form with only 1 text input and 1 button input submit on enter?

Discussion in 'HTML' started by Guy, Dec 13, 2003.

  1. Guy

    Guy Guest

    Am I doing something wrong?

    I have a form with ony a regular text input, and only one button, not a
    submit button, a button button.

    Yet when my cursor is in the text box and I hit enter, the form submits, as
    if my button was a submit button - but it's not.

    Moreover, if I add a second regular text input, and my cursor is in one of
    those 2 input boxes and then I hit enter, nothing happens - which is what
    you'd expect, unless you had a submit button - which I dont! :)

    I'm using IE6... Is this a bug?
    Guy
    Guy, Dec 13, 2003
    #1
    1. Advertising

  2. Re: why does form with only 1 text input and 1 button input submiton enter?

    Guy wrote:
    > I have a form with ony a regular text input, and only one button, not a
    > submit button, a button button.
    >
    > Yet when my cursor is in the text box and I hit enter, the form submits, as
    > if my button was a submit button - but it's not.
    >
    > Moreover, if I add a second regular text input, and my cursor is in one of
    > those 2 input boxes and then I hit enter, nothing happens - which is what
    > you'd expect, unless you had a submit button - which I dont! :)
    >
    > I'm using IE6... Is this a bug?


    The bug would be not submitting when there are two text boxes. Submit
    button is just a means of submission.
    Leif K-Brooks, Dec 13, 2003
    #2
    1. Advertising

  3. Guy

    Guy Guest

    "Leif K-Brooks" <> wrote in message
    news:XVvCb.448$7%...
    > Guy wrote:
    > > I have a form with ony a regular text input, and only one button, not a
    > > submit button, a button button.
    > >
    > > Yet when my cursor is in the text box and I hit enter, the form submits,

    as
    > > if my button was a submit button - but it's not.
    > >
    > > Moreover, if I add a second regular text input, and my cursor is in one

    of
    > > those 2 input boxes and then I hit enter, nothing happens - which is

    what
    > > you'd expect, unless you had a submit button - which I dont! :)
    > >
    > > I'm using IE6... Is this a bug?

    >
    > The bug would be not submitting when there are two text boxes. Submit
    > button is just a means of submission.
    >

    I'm not sure if I was clear, sorry about that. Here is the actual form in my
    HTML file.

    <FORM name=fname method=post action='../cgi-bin/itl.cgi'
    enctype='multipart/form-data'>
    <INPUT name=fil type=file size=80><BR><BR>
    You can optionally specify a different filename to save it as:<BR>
    <INPUT name=filn type=text size=32><BR><BR>
    Please note that it can take up to 30 seconds or more to submit large
    files.<BR><BR>
    <INPUT type=button value=Submit onclick="send();">
    </FORM>

    When I click on the button, it executes the send function which does a bit
    of checking and then submits the form.

    If however my cursor is in the text input, and I hit enter, the form is
    submitted, but of course, the send function is not executed so none of the
    checking getrs done.

    Guy
    Guy, Dec 13, 2003
    #3
  4. Re: why does form with only 1 text input and 1 button input submiton enter?

    Guy wrote:
    > I'm not sure if I was clear, sorry about that. Here is the actual form in my
    > HTML file.
    >
    > <FORM name=fname method=post action='../cgi-bin/itl.cgi'
    > enctype='multipart/form-data'>

    <snip>
    > If however my cursor is in the text input, and I hit enter, the form is
    > submitted, but of course, the send function is not executed so none of the
    > checking getrs done.


    Use the onsubmit attribute of the form element instead, but don't rely
    on client-side checking.
    Leif K-Brooks, Dec 13, 2003
    #4
  5. Guy

    brucie Guest

    in post <news:lqvCb.10591$>
    Guy said:

    > Am I doing something wrong?
    >
    > I have a form with ony a regular text input, and only one button, not a
    > submit button, a button button.
    >
    > Yet when my cursor is in the text box and I hit enter, the form submits, as
    > if my button was a submit button - but it's not.
    >
    > Moreover, if I add a second regular text input, and my cursor is in one of
    > those 2 input boxes and then I hit enter, nothing happens - which is what
    > you'd expect, unless you had a submit button - which I dont! :)


    FORM submission and the ENTER key?
    http://ppewww.ph.gla.ac.uk/~flavell/www/formquestion.html


    --
    brucie
    13/December/2003 04:22:59 pm kilo
    brucie, Dec 13, 2003
    #5
  6. Guy

    brucie Guest

    in post <news:65wCb.10610$>
    Guy said:

    > <INPUT type=button value=Submit onclick="send();">
    >
    > When I click on the button, it executes the send function which does a bit
    > of checking and then submits the form.


    when i and about 100 million other people hit the button nothing at all
    happens. do not use optional client side goodies for critical functions.

    Javascript form validation ¡V doing it right
    http://www.xs4all.nl/~sbpoley/webmatters/formval.html

    --
    brucie
    13/December/2003 04:42:00 pm kilo
    brucie, Dec 13, 2003
    #6
    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. Neo
    Replies:
    2
    Views:
    3,186
    bruce barker
    May 11, 2004
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,761
    Smokey Grindel
    Dec 2, 2006
  3. Guest
    Replies:
    2
    Views:
    1,563
    Guest
    Oct 25, 2004
  4. Megha Vishwanath
    Replies:
    3
    Views:
    683
    Megha Vishwanath
    Jul 20, 2004
  5. HopfZ
    Replies:
    0
    Views:
    539
    HopfZ
    Aug 28, 2006
Loading...

Share This Page