Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Field verification problem...

    Hi,

    i have spent hours trying to figure out what the problem was, but never succeeded!
    so first things first: I am developping an ecommerce type of website where i have a login page that requires the user a login and a password. Now i am performing all testings on Internet Explorer with no restrictions whatsoever.
    I have a javaspript function that checks wether the login field or the password field are empty or not.
    So, when testing, i intentionally leave the login field blank, and to this point everything is fine, because the javascript function alerts me and tell me that i have omitted the login field. But...now is where the problem lies. Once i have adjusted to what javascript told me and typed my login, and then purposly leave the login field blank, now javascript will NOT alert me and my identification form will go on to the page that checks login/pwd with my database.
    Now here is the relevant code:

    first, the form:
    <form name="ident" method="POST" action="identification.php" onsubmit="return Check_Identification(this)">
    <div align="center">
    <p>&nbsp;</p>
    <table border="1" cellpadding="0" cellspacing="12" width="260" >
    <tr>
    <td>Login</td>
    <td><input type="text" name="Login"></td>
    </tr>
    <tr>
    <td>Password</td>
    <td><input type="text" name="Pwd" ></td>
    </tr>
    <tr>
    <td colspan="2" class="right"><input type="submit" value="Submit" name="Action"></td>
    </tr>
    </table>
    <p>&nbsp;</p>
    </div>
    </form>


    now, on to the javascript function:
    <script type="text/javascript">

    function Check_Identification(f)
    {
    var Test=f.elements['Login'];
    if (Test.value == "" || isNonVide(Test.value) == false)
    {

    alert("please enter login");
    Test.focus();
    return false;
    }

    var Test=f.elements['Pwd'];
    if (Test.value == "" || isNonVide(Test.value) == false)
    {
    alert("please enter pwd");
    Test.focus();
    return false;
    }

    return true;
    }
    </script>

    Got any idea?

    Thanks you!

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Where's the function isNonVide()?

    PS: use [code] tags!

  • #3
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts


  •  

    Posting Permissions

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