Hello,
I am new to kendo and the forum. I am having trouble understanding how to use the Validator with Observable objects and templates. I can data-bind all of the data and the validator works great on views with no templates or nested objects but when I try to implement the validator on a page that contains a template, it does not work as expected.
So, on initially changing an input, I get the proper validation error. But then when I change any other field, all of my error messages go away.
For example, field2 must be length 10. So if I input a number of length 4 on the first object, i get a validation message when I leave the field. Now, if I go edit any other field rendered then that validation message will go away even though the length is still 4 in that input. So if I change the second objects field 3, then i lose my validation message on object ones field2.
On my other views without templates, the validation messages stay until I validate the field, they don't change based on other fields changing.
Hopefully this is enough information, let me know if I left something out or need to be more specific.
The code looks like this:
<div id="fieldTab"> <div data-bind="source: fields" data-template="fieldTemplate" /></div> <script id="fieldTemplate" type="text/x-kendo-template"> <select name="field1#= fieldSys#" data-role="dropdownlist" data-bind="value: field1" /> <input name="field2#= fieldSys#" class="k-textbox" type="text" pattern=".{10,10}" data-bind="value: field2" /> <input name="field3#= fieldSys#" class="k-textbox" pattern=".{0,20}" type="text" data-bind="value: field3" /></script>
var fieldTab = $("#fieldTab");var viewModel = kendo.observable({ fields: [
{fieldSys: "1",field1: "1", field2: "1", field3: "1"}, {fieldSys: "2",field1: "2", field2: "2", field3: "2"}, {fieldSys: "3",field1: "3", field2: "3", field3: "3"} ]});fieldTab.kendoValidator().data("kendoValidator");kendo.bind(fieldTab, viewModel);