I have a ViewModel similar to this one (simplified):
var Person = function(){
var self = this;
self.Name = ko.observable();
self.LastName = ko.observable();
self.DriverId = ko.observable();
}
var MainViewModel = function(){
var self = this;
self.People = ko.observableArray();
}
I need to validate that the Driver Id is unique for each element of the array. What is the best way to do this? is it possible to create an MVC attribute? I couldn't find how since I've only done that for a specific class, not a collection.
Here is a JsFiddle with the ViewModel: http://jsfiddle.net/amhedh/VgJ59/6/