![]() |
|
|
|
#1 |
|
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 John Livermore |
|
|
|
|
#2 |
|
Posts: n/a
|
"John Livermore" <> wrote in message news:... > 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 |
|
|
|
#3 |
|
Posts: n/a
|
John Livermore <> wrote:
> <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. -- Yucca, http://www.cs.tut.fi/~jkorpela/ Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html |
|
|
|
#4 |
|
Posts: n/a
|
"Jukka K. Korpela" <> wrote in
news:Xns948B1B966EA6jkorpelacstutfi@193.229.0.31: > John Livermore <> wrote: > >> <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. 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. |
|
|
|
#5 |
|
Posts: n/a
|
Eric Bohlman <> wrote:
>> 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. 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/...mquestion.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. -- Yucca, http://www.cs.tut.fi/~jkorpela/ Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html |
|