Click to See Complete Forum and Search --> : IE html behavior err?


rchoppin
05-01-2003, 04:43 PM
:mad: This html:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function f_submit () {
alert ( 'f_submit' );
return;
}
function f_chg () {
alert ( 'f_chg' );
return;
}
</SCRIPT>
</HEAD>
<BODY >
<FORM NAME="act_form" ONSUBMIT="f_submit()" >
<INPUT TYPE="TEXT"
NAME="chg"
VALUE="25"
ONCHANGE="f_chg()"
>
<INPUT TYPE="TEXT"
NAME="chg2"
VALUE="25"
ONCHANGE="f_chg()"
>
</FORM>
</BODY>
invokes the f_sumit() function with
only the first input element
and the f_chg() function with both
input elements, if the value in
the first input element is changed.

questions:
a) is this standard browser behavior
(standards vs. microsoft); it doesn't work this way with netscape.
b) is there anyway to suppress the
submission (I tried to return false and it submits anyway).
c) in the case of two input elements,
changing the value and hiting the enter key rings a bell. You have to
tab to an new field or click on a new field to get the f_chg to invoke.

I've also tried adding another (hidden) input element.

rchoppin
05-01-2003, 06:41 PM
Thanks Dave.
It wasn't intuitively obvious that return had to be used twice!

If this is standard behavior, it introduces a subtle bug into programs that generate multiple rows of input elements based on db queries. the form behaves differently depending on the number of rows returned ( and therefore the numnber of input text elements ). That's how I ran accross this issue.

How is this standard behavior for a browser? Netscape doesn't do this. Is it a standard or just MS IE usage? If it is a standard other than MSIE usage it is a BAD standard.

Using the 'enter' key on text fields to do a default submit when there are other input elements on the form is just plain stupid.

I wonder how other browsers deal with this.

Another issue: is there a way to suppress the 'bell' on the 'enter' key? The bell rings before any even handlers I've tried can get control.

rchoppin
05-01-2003, 07:14 PM
Thanks again. I don't test with other browsers than Netscape and IE, but netscape does NOT submit on the enter key if there is no submit button. Also, IE does not submit UNLESS focus is on a text input element. I looked for where the 'bell on enter' would be set in the 'sounds' and IE customization and had no joy. My users really hate having the bell go off. Is here some place you can configure the enter key to suppress the bell?

rchoppin
05-01-2003, 08:54 PM
Ahh; light dawns; the bell occures AFTER keydown and BEFORE keyup, so yours does not ring since you intercept keydown. AND your code fixes ALL the TABBING grief I've experienced. Not sure why window.Event is ever not null (it is window.event in my docs), but I'll play with it till I know. Incidentally, the 'enter' key submits on an INPUT type='BUTTON' as well. All in all, much thanks. saved me a couple of man-days of puttering around and looking for info.:D I DID check the places you mentioned for sounds but the solution was in your code.