Essentially I have MVVM binding to a remote data source.
<
input
type
=
"text"
id
=
"jobName"
data-bind
=
"value: data.Name"
class
=
"k-input validate"
required />
var validatable = $("#windowUpdateJob").find("#jobName").kendoValidator().data("kendoValidator");
When I initialize the validator, it seems to break the jobName object. Various things cause the following error:
kendo.all.js ~line # 7130 - this.widget.value is not a function
Without the validator it works ok.
I also found that if I just add a data-role to the <input> it also fixes the issue. i.e.
<
input
type
=
"text"
data-role
=
"NumericTextBox"
id
=
"jobName"
data-bind
=
"value: data.Name"
class
=
"k-input validate"
required />
Maybe I'm doing something funky somewhere else in the code that's causing this? I don't have a problem adding a data-role to all MVVM objects, but in this case jobName is not numeric - that's just the quickest thing I found that worked.
6 Answers, 1 is accepted
The behavior you are experiencing is due to the fact that a kendoValidator is instantiated over a element which has value binding defined. This will instruct the MVVM that this element is a widget and a widget value binding should be applied. However, in this case the value binding is not valid as the widget is kendoValidator which does not support value. In order to workaround this limitation you should instantiate the kendoValidator over the container element of the input instead.
Greetings,Rosen
the Telerik team
I'm afraid that I'm not aware of such behavior. Thus, it will be appreciated if you could provide a simple jsFiddle test page which exhibits the mentioned issue.
All the best,Rosen
the Telerik team
I'm having the same problem as described by Nick.
Here is a fiddle to demonstrate. Validation only triggers if you enter something and then clear it, but then it dissappears the moment you release the save button.
Fiddle example
Carlos
In order for Kendo Validator to function correctly, the input elements which requires validation should have valid name attributes set. Thus, please add such attributes and see if there is changed in the observed behavior.
Greetings,Rosen
the Telerik team
I found this forum post because my issue was with validators showing up next to the wrong input field. Your comment about adding name attributes was the solution. I notice the jsFiddle posted above experiences the same problem I was having. I added name attributes in the jsFiddle and my project and the problem went away in both cases.
Bottom line is that this should be proclaimed far and wide: All Kendo UI validation targets should have a unique name attribute.
Thanks,
Zachary