Results 1 to 3 of 3

Thread: Confirm password

  1. #1
    Join Date
    Oct 2005
    Location
    england
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Confirm password

    hi how do you create to fields in a form so that the check to make sure thier the same couz i'm tryin to make a register form and i need and password and confirm password field.

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Hybrid
    hi how do you create to fields in a form so that the check to make sure thier the same
    Code:
    function validate(form) {
      var elem = form.elements;
    
      if(elem.password.value != elem.confirm.value) {
        alert('Please check your password; the confirmation entry does not match.);
        return false;
      }
      return true;
    }
    HTML Code:
    <form action="..." method="post" onsubmit="return validate(this);">
      <!-- ... --->
      <label>Password: <input name="password" type="password" value=""></label>
      <label>Confirm password: <input name="confirm" type="password" value=""></label>
      <!-- ... -->
    </form>
    couz i'm tryin to make a register form and i need and password and confirm password field.
    Just make sure you check the values server-side!

    Mike

  3. #3
    Join Date
    Oct 2005
    Location
    england
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanx

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
  •