Annoying Login Problem - Works in IE not in FF

Hey guys,
Ive got an issue here with a site that Im working on. Im receiving several emails a day from members complaining that they “cant login”

Upon troubleshooting, its become apparent that this issue is definitely related to Firefox. In particular FF 4.0.1

Put simply, the request objects are being “lost” when posted from the form to the next page. Ive read on other forums that for some reason, FF may ignore the POST command and instead, use GET. I have absolutely no idea why, but I need to get to the bottom of this.

I have debugged and found that the form objects “email” and “password” are completely blank (lost) and not being passed to the SQL script on the following page which validates login.

Heres the code…(including the Javascript checklogin script)

<SCRIPT LANGUAGE=“JavaScript”>

//CARRY OUT FORM VALIDATION
function checklogin() {
if (document.login.login_email.value == “”) {
alert(“You must enter your email address.”);
return false; }

	var result
	
	var str=document.login.login_email.value
	var filter=/^.+@.+\\..{2,3}$/
	
	if (filter.test(str))
		result=true
	else {
		alert("You must enter a valid email address")
		result=false
	return false;  }
	
	if (document.login.login_password.value == "") {
	alert("You must enter your password.");
	return false;  }			

}

</script>

<form name=“login” method=“post” action=“/members/members_verifylogin.asp” style=“margin:0px” onSubmit=“return checklogin()”>

<input class="textarea"form type=“text” name=“login_email” size=“20”>

<input class="textarea"form type=“password” name=“login_password” size=“20”>

<input class=sbttnorange type=“submit” name=“login” value=“LOGIN”>

</form>

Then on the following page I have…

email = trim(Replace(request.form(“login_email”), “'”, “”))
password = trim(Replace(request.form(“login_password”), “'”, “”))

What I do know for certain is that both values are empty and arent being passed.

What I dont know, is if there is an issue with my Javascript code that may be causing this issue. Unlike IE, when you dont enter anything into the text fields, FF simply submits the form and the javascript fails to work.

IE prompts with the correct message.

Again this works fine in IE, just not in FF.

Help!

The name resolution of document.formname.formelementname has been deprecated for about 10 years. Time to get with the program, before IE catches up, too.

Umm, Im not sure if that helps me any?

Can you at least provide an example?

Anyone at all?

Ive been at this now for 48 hours.

This works fine for me on FF4 - note I did edit it some (added brackets, semicolons, removed form in the input fields) …


        <script>
			function checklogin() {
				var frm = document.login,
					result,
					str = frm.login_email.value,
					filter = /^.+@.+\\..{2,3}$/;

				if (str === "") {
					alert("You must enter your email address.");
					return false; 
				}

				if (filter.test(str)) {
					result = true;
				} else {
					alert("You must enter a valid email address");
					result = false;
					return false; 
				}

				if (frm.login_password.value === "") {
					alert("You must enter your password.");
					return false; 
				}
			}        
        
        </script>
    </head>
    <body>
		<form name="login" method="post" action="" style="margin:0px" onSubmit="return checklogin()">
			<input class="textarea" type="text" name="login_email" size="20" />
			<input class="textarea" type="password" name="login_password" size="20" />
			<input class="sbttnorange" type="submit" name="login" value="LOGIN">
		</form>    
    

Thanks but that hasnt made any difference.

The javascript isnt doing anything and the form objects are lost when submitting the form.

I have verified that javascript is enabled in the browser.

I simply removed the “form” from the input fields and the code starting working in FF4.

<input class="textarea"form type=“text” name=“login_email” size=“20”>
to
<input class=“textarea” type=“text” name=“login_email” size=“20”>

DUDE!!

You’re an absolute champion.

It works :slight_smile:

I cant even understand why those “form” tags where there in the first place???

Surprised it worked at all. It has been for years, strangely enough.

Thanks man, really appreciate it.