Closed nithinkrishnanp closed 8 years ago
Hello,
According to the readme, you should create a custom valdr. Here, you want to compare two fields and assert that they are equal. So, add a custom valider:
angular.module('yourAppName').factory('sameValidator', function () {
return {
name: 'same',
validate: function (value, args) {
return value === document.querySelector('[name="'+args.as+'"]').value;
}
};
});
And use it:
"password": {
"required": {
"message": "errors.message.required"
}
},
"PasswordConfirm": {
"required": {
"message": "errors.message.required"
},
"same": {
"as": "password",
"message": "errors.message.sameAs"
}
}
I hope that could help!
@laudeon +1
Hi, Please refer the custom validation. Then u can validate easily On 09-Mar-2016 8:22 am, "Milos Bejda" notifications@github.com wrote:
@laudeon https://github.com/laudeon +1
— Reply to this email directly or view it on GitHub https://github.com/netceteragroup/valdr/issues/97#issuecomment-194088982 .
You got the solution, thank you community members. However, this issue list is not a support forum, see https://github.com/netceteragroup/valdr#support.
I need to to equate the password & confirm password using valdr?.. how it is possible?