I am trying to use knockout.validation plugin. I want created a custom validation rule for checking the duplicate array item while making entry in the array. I tried this :
ko.validation.rules['duplicate'] = {
validator: function (val1, val2) {
},
message: 'The value is already exist'
};
ko.validation.registerExtenders();
Here val1
is the array and val2
is the parameter pass in with the extend method. The problem is, i don`t know how to access the current entered item in the array from custom validation function. help me please ?