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)