I have used Jquery Form validator in my laravel application. But validation on password and password confirmation is not working. Console through the following error:-
jquery.form-validator.js:1276 Uncaught Error: Using undefined validator "validate_strength". Maybe you have forgotten to load the module that "validate_strength" belongs to?
and
jquery.form-validator.js:1276 Uncaught Error: Using undefined validator "validate_confirmation". Maybe you have forgotten to load the module that "validate_confirmation" belongs to?
Following is my HTML Code from view-source
.....
<div class="form-group row required">
<label for="password_confirmation" class="col-sm-2 control-label">Password</label>
<div class="col-sm-10">
<input placeholder="Enter Password" class="form-control" data-validation="strength" data-validation-strength="2" name="password_confirmation" type="password" value="" id="password_confirmation">
<span style="color: #c9302c"></span>
</div>
</div>
<div class="form-group row required">
<label for="password" class="col-sm-2 control-label">Confirm Password</label>
<div class="col-sm-10">
<input placeholder="Re-enter Pasword" class="form-control" data-validation="confirmation" name="password" type="password" value="" id="password">
<span style="color: #c9302c"></span>
</div>
</div>
.....
and my js code
(function($, window) {
window.applyValidation = function(validateOnBlur, forms, messagePosition, xtraModule) {
if( !forms )
forms = 'form';
$.validate({
modules : 'security',
form : forms,
language : {
requiredFields: 'Required Fields'
},
validateOnBlur : validateOnBlur,
lang : 'en',
onValidate : function($f) {
var $callbackInput = $('#callback');
},
onModulesLoaded : function() {
var optionalConfig = {
fontSize: '12pt',
padding: '4px',
bad : 'Very bad',
weak : 'Weak',
good : 'Good',
strong : 'Strong'
};
$('input[name="password_confirmation"]').displayPasswordStrength(optionalConfig);
}
});
};
window.applyValidation(true, '#candidate-signup', 'top');
})(jQuery, window);
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire