0
votes

Does the knockout validation library has changed? I've searched all over and I've found that for "initialize" knockout validation we must call something like that:

ko.validation.init({ parseInputAttributes: true, writeInputAttributes: true });

or

ko.validation.configuration({
registerExtenders: true,
messagesOnModified: true,
insertMessages: true,
parseInputAttributes: true,
messageTemplate: null
});

But, after I installed the plugin via NuGet, I typed

ko.validation.

and neither the "init" or "configure" method showed up.

And when I run the application, the Chrome JS console shows me an error: "Uncaught TypeError: Cannot read property 'init' of undefined" and a red line under ".init({ parseInputAttributes: true, writeInputAttributes: true });" and, of course, the validation is not working.

So this tells me that the knockout library has changed OR I'm missing something big here.

PS: I would have sent you guys screenshots of my issues, but I must have at least 10 reputation to post images and that is my first question :)

1
Sounds like you're not even loading the knockout.validation.js file in your page. - JohnnyHK

1 Answers

0
votes

As for passing configuration only the ko.validation.init( /* options object */ ); is valid now. The configuration method is far gone.

However, if you are fine with the default config you don't even need to do that. Just start using it. What seems to be your problem, though; is that you don't even fetch the library... Make sure you have the file available on the server and referenced in the code, chrome console's Network tab will help you localize missing files too :)