How to do a validation to find duplicate entries ? knockout <p>I have a scenario when i dynamically add multiple rows using <code>template</code> way i need to write down a validation if <code>CountryCode</code> (which should be unique) having same value in two or more dynamically generated rows .</p> <p><strong>working fiddle</strong> : <a href="http://jsfiddle.net/JL26Z/73/" rel="nofollow">http://jsfiddle.net/JL26Z/73/</a></p> <p>Well i am thinking can this be possible using custom validation code but i am not sure how to proceed i mean how to compare in <code>validator</code> function inside <code>validation</code> .</p> <p>And the same can be done on click of <code>submit</code> in save function like we run a foreach each aganist every row <code>code</code> and do it but is it a good practice . </p> <p><strong>My view model:</strong></p> <pre><code> function Phone() { var self = this; self.Code = ko.observable(""); // this should be unique self.Date = ko.observable(""); self.PhoneNumber = ko.observable(""); self.Validation = ko.validatedObservable([ self.Code.extend({ required: true }), self.Date.extend({ required: true }), self.PhoneNumber.extend({ required: true }) ]); } function PhoneViewModel() { var self = this; self.PhoneList = ko.observableArray([new Phone()]); self.remove = function () { self.PhoneList.remove(this); }; self.add = function () { self.PhoneList.push(new Phone()); // i add on click of add button }; } ko.applyBindings(new PhoneViewModel()); </code></pre> <p>Any suggestions are appreciated .</p>