SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist ramone_johnny's Avatar
    Join Date
    Jan 2004
    Location
    Brisbane - Australia
    Posts
    434
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Unhappy 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!

  2. #2
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Evangelist ramone_johnny's Avatar
    Join Date
    Jan 2004
    Location
    Brisbane - Australia
    Posts
    434
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Umm, Im not sure if that helps me any?

    Can you at least provide an example?

  4. #4
    SitePoint Evangelist ramone_johnny's Avatar
    Join Date
    Jan 2004
    Location
    Brisbane - Australia
    Posts
    434
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Anyone at all?

    Ive been at this now for 48 hours.

  5. #5
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    336
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This works fine for me on FF4 - note I did edit it some (added brackets, semicolons, removed form in the input fields) ...

    Code HTML4Strict:
            <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>

  6. #6
    SitePoint Evangelist ramone_johnny's Avatar
    Join Date
    Jan 2004
    Location
    Brisbane - Australia
    Posts
    434
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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.

  7. #7
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    336
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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">

  8. #8
    SitePoint Evangelist ramone_johnny's Avatar
    Join Date
    Jan 2004
    Location
    Brisbane - Australia
    Posts
    434
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by centered effect View Post
    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

    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •