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, Dec 13, 2003
    1. Advertisements

  2. 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
    1. Advertisements

  3. Guy

    Guy Guest

    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'
    <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
    <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.

    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, Dec 13, 2003
  4. Use the onsubmit attribute of the form element instead, but don't rely
    on client-side checking.
    Leif K-Brooks, Dec 13, 2003
  5. Guy

    brucie Guest

    FORM submission and the ENTER key?
    brucie, Dec 13, 2003
  6. Guy

    brucie Guest

    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
    brucie, Dec 13, 2003
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.