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

G

Guy

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
 
L

Leif K-Brooks

Guy said:
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.
 
G

Guy

Leif K-Brooks said:
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
 
L

Leif K-Brooks

Guy said:
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'>
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.
 
B

brucie

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top