Standard domcfg authentication form & Mozilla -> JS errors

I’m using Mozilla Firefox 0.8 on Windows XP. Mozilla has a JavaScript console which is handy for checking any unseen errors in the JavaScript. Today when logging on with the standard $$LoginUserForm from domcfg.nsf I noticed that every key (for entering the username) led to the error: window.event has no properties. This seems to be caused by this piece of JavaScript://submit the form if the user presses the ENTER key

function checkEnter(event)

{

var code = 0



if (NN4) {

	code = event.which

} else {

	code = window.event.keyCode

}

	

if (code==13)

	document.forms[0].submit()

}

Funny enough the script does work. When I press ‘enter’ it signs in. Has anyone else noticed this behavior and found a solution to keep the errors from appearing?

Subject: Standard domcfg authentication form & Mozilla → JS errors

It looks like the script is checking if the browser is Netscape 4 and if so using the Netscape event handler (event.which) to grabe the key being pressed. If 13 (which is the enter key) it is then submitting the form. The reason FireFox is bombing is because it doesn’t meet the Netscape 4 check in the if statement and is then trying to use the IE event handler (event.KeyCode). Because this is not a supported event in Firefox it is bombing out.

The reason it continues and submits the form is because Firefox took its lead from IE. In IE even early versions if you pressed the enter key, IE assumed you wanted to submit the form. FireFox adopted the same idea. If you are filling out the form and hit the enter key it assumes you want to submit the form.

hth,

Wendall