why does this "bung" me

J

John Livermore

In IE 6.0 if you load an HTML document that looks like the
following...

<HTML>
<body>
<form>
<input type="text" /> <input type="text" />
</form>
</body>
</HTML>


the browser makes a noise if you put the focus in one of the textboxes
and hit 'enter' (noise sounds like a dull 'bung!'). If you remove one
of the textboxes the noise doesn't occur. Can someone explain to me
why this is happening?

Thanks,
John
 
A

Augustus

John Livermore said:
In IE 6.0 if you load an HTML document that looks like the
following...

<HTML>
<body>
<form>
<input type="text" /> <input type="text" />
</form>
</body>
</HTML>


the browser makes a noise if you put the focus in one of the textboxes
and hit 'enter' (noise sounds like a dull 'bung!'). If you remove one
of the textboxes the noise doesn't occur. Can someone explain to me
why this is happening?

add a submit button and it will stop
 
J

Jukka K. Korpela

John Livermore said:
<form>
<input type="text" /> <input type="text" />
</form>

Why would you do that?
the browser makes a noise if you put the focus in one of the
textboxes and hit 'enter' (noise sounds like a dull 'bung!').

The markup is invalid in a serious way, since there is no action
attribute, hence no defined meaning for form submission.
If you remove one of the textboxes the noise doesn't occur. Can
someone explain to me why this is happening?

Maybe the browser keeps submitting the form to the page itself
and autofocusing. Who knows, and who cares? Just do the right thing,
and let browsers do strange things with incorrect HTML.
 
E

Eric Bohlman

Why would you do that?


The markup is invalid in a serious way, since there is no action
attribute, hence no defined meaning for form submission.


Maybe the browser keeps submitting the form to the page itself
and autofocusing. Who knows, and who cares? Just do the right thing,
and let browsers do strange things with incorrect HTML.

That wouldn't explain why he doesn't get the "error sound" with only one
field, and in any case I think he left off the action because he was just
trying to construct a short example, knowing full well that he'd need one
in real life.

The reason, I'm quite sure, is that when you have only one text field, or
multiple text fields with a submit button, hitting enter has a defined
result: submitting the form. But when there are multiple text fields and
no submit button, hitting enter doesn't have a defined result, and the
browser is simply alerting the user that the key he pressed has no meaning.
 
J

Jukka K. Korpela

Eric Bohlman said:
That wouldn't explain why he doesn't get the "error sound" with
only one field, and in any case I think he left off the action
because he was just trying to construct a short example, knowing
full well that he'd need one in real life.

Really? I've seen so many form elements without action attributes in
real life, apparently based on a hope that browsers will do some
suitable guesses, or have client-side scripting enabled.

In this case, the behavior is indeed independent of the action
attribute. But it would be fair to expect a person with a problem post
a valid sample or its URL.
The reason, I'm quite sure, is that when you have only one text
field, or multiple text fields with a submit button, hitting enter
has a defined result: submitting the form.

Actually, no. The HTML 4 specification does not define such things at
all. It does not describe all the ways that could be used to submit a
form. The HTML 2.0 spec had a vague statement about Enter perhaps
submitting a form, and browsers have implemented the idea in
devastatingly different and irritating ways, see
http://ppewww.ph.gla.ac.uk/~flavell/www/formquestion.html

So it's undefined, no matter what the amounts of input elements and
other fields are.

What we have is yet another oddity from Microsoft. A form with multiple
text input fields _should not_ be submitted by simply hitting enter in
one field, whether there is a submit button or not - HTML 2.0 surely
didn't mean _that_. But people seem to have got so used to such
features that ask for them if they have been fixed in some special
cases.
 

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

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top