Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How confirm and match the password fields on a html form

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.44k
    Comment on it

    Hello Reader!, If you looking for a front end validation for matching the two passwords feilds with Javascript then you can see how to get it done.

    Lets consider the example below

    Here i'm using the html code for the form

     <form class="example1" method = "post" action = '#'>
            <div class="password">
                <label class="col-xs-3 control-label">Password</label>
                <div class="col-xs-5">
                    <input type="password"  name="password" />
                </div>
            </div>
    
            <div class="password">
                <label class="col-xs-3 control-label">Please Type Again</label>
                <div class="col-xs-5">
                    <input type="password"  name="confirmPassword" />
                </div>
            </div>
        </form>
    

    And for validation part you need to write the script.

    <script>
    $(document).ready(function() {
        $('#example1').formValidation({
              icon: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                confirmPassword: {
                    validators: {
                        identical: {
                            field: 'password',
                            message: 'The two passwords do not match'
                        }
                    }
                }
            }
        });
    });
    </script>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: