#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    108
    Rep Power
    12

    javascript problem submitting form with button


    HELP!

    PHP Code:
    function checkMemberName() {
    // Checks input username for validity.
        var theLength = document.Form.memberName.value.length;
        var isValid = '';
        if (theLength < 4) isValid = 'no';
        if (isValid == 'no') {
            alert(unescape('You have not entered a proper username.'));
            document.Form.memberPassword.value = '';
            document.Form.memberName.focus();        
            return false;
            }
        else return true;        
        }
        
    function checkMemberPassword() {
    // Checks input password for validity.
        var theLength = document.Form.memberPassword.value.length;
        var isValid = '';
        if (theLength < 1) isValid = 'no';
        if (isValid == 'no') {
            alert(unescape('You have not entered a password.'));
            document.Form.memberPassword.value = '';
            document.Form.memberPassword.focus();        
            return false;
            }
        else return true;        
        }    

    //Actual form:

                            <form name="Form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                                USERNAME: <input type="text" maxlength="15" size="15" name="memberName">
                                <br>
                                PASSWORD: <input type="password" maxlength="20" size="15" name="memberPassword">
                                <br><br>
                                <input type="hidden" name="submit">
                                <input type="button" Value="ENTER" style="color: #3C82CA;" onClick="if (checkMemberName() && checkMemberPassword()) document.Form.submit();">
                            </form>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Posts
    1,014
    Rep Power
    15
    <input type="hidden" name="submit">
    The name of this hidden field causes the error.
    Just rename it.

    Hope this helps,
    Jeroen
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    108
    Rep Power
    12
    thanks so much man!

IMN logo majestic logo threadwatch logo seochat tools logo