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 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts

    Problem with form onSubmit

    I have the following code on the onSubmit part of my form and when I click submit if I have two different things in the password section the alert comes up, but if I do the same with the email or the checkbox it carries on as normal, even if I put return false at the end. I'm pretty new to javascript, but have lots of PHP experience, and can't find what's wrong. Thanks for any replies.

    PHP Code:
    <script>
    function 
    checksubmit(){
        if (
    document.create.password.value != document.create.confirmpassword.value){
            
    alert('Your two passwords do not match.');
            return 
    false;
        }
        if (
    document.create.email.value != document.confirmemail.value){
            
    alert('Your two emails do not match.');
            return 
    false;
        }
        else if (!
    document.create.tac.checked){
            
    alert('You have to agree to the terms and conditions.');
            return 
    false;
        }
        return 
    false;
    }
    </script> 
    Last edited by Mwnciau; 01-14-2007 at 03:07 AM.

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    fixed


  •  

    Posting Permissions

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