I've been using Knockout a bit and tried now to use the separate validation-library with it. My ko-version is 3.3.0 and knockout-validation is 2.0.3, so they should be up to date. I'm running this simple example with Chrome that is presented in https://github.com/Knockout-Contrib/Knockout-Validation:
var myViewModel = ko.validatedObservable({
property1: ko.observable().extend({ required: true }),
property2: ko.observable().extend({ max: 10 })
});
console.log(myViewModel.isValid()); //false
myViewModel().property1('something');
myViewModel().property2(9);
console.log(myViewModel.isValid()); //true
However when running that locally in Chrome it gives me true for both isValid()-calls, so even though it is required and it's empty, it's valid. Some of the validations are working however:
var myViewModel = ko.validatedObservable({
property: ko.observable().extend({ min: 10 })
});
myViewModel.isValid() // true, should be false though I guess?
myViewModel().property("test")
myViewModel.isValid() // false
What could be wrong there? Both libraries are in pretty heavy use and are the most recent versions, so I can't see why the examples aren't working.