[thelist] with Enter, onBlur is preceded by onSubmit

Ken Kogler ken.kogler at cph.org
Thu Jun 13 14:55:01 CDT 2002


IE is the only browser that equates a user pressing 'enter' with a form's
submit behavior by default. This is annoying and obnoxious, IMO, so I plug a
bit of javascript into my page, and *poof* - the problem goes away.

Here's the code I use:

  <script LANGUAGE="Javascript">
    function submitsthis() {
      document.forms[0].submit();
    }
  </script>

Then change your submit button from type="submit" to type="button", and add
onClick="submitsThis();"

You should be good to go, as long as your users have javascript enabled...

-Ken

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Bill Haenel
Sent: Thursday, June 13, 2002 2:39 PM
To: thelist at lists.evolt.org
Subject: [thelist] with Enter, onBlur is preceded by onSubmit


When submitting a form in IE 6 and 5.5 (and assumably 5.0) my form field's
onBlur event is being preceded by the form's onSubmit event. The onBlur does
occur, but after the onSubmit. This happens ONLY WHEN the Enter key is used
to submit the form. When actually clicking on the submit button this does
not happen.

I have tried changing the onBlur to an OnChange (it's a text field), but the
same occurs.

Is this normal? How come only IE? NN4+ all seem to be fine. How might I fix
this? Anyone? Anyone?

Thx,

Bill

--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !




More information about the thelist mailing list