This is a migrated thread and some comments may be shown as answers.

validate callback doesn't work

3 Answers 111 Views
Validation
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jwize
Top achievements
Rank 1
jwize asked on 10 May 2014, 08:40 PM
This is straight forward but the callback is never hit. 

        $("#form1").kendoValidator({
            validate: function(e) {
                debugger
                console.log("valid" + e.valid);
            }
        }).validate();

Can anybody help me on this (Yes the form exists)?
Also, shouldn't this also be hit on blur?  

3 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 13 May 2014, 10:27 AM
Hi Jaime,

As you may know the validate is method of the kendoValidator widget. However in the snippet you have pasted it is called on the actual form element. This is what is return by the jQuery plugin creator method (kendoValidator())
Therefore, in order to execute the validate method you will need to get the widget instance first, similar to the following:

$("#form1").kendoValidator({
  validate: function(e) {
    debugger
    console.log("valid" + e.valid);
  }
}).data("kendoValidator").validate();


Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
ken
Top achievements
Rank 1
answered on 17 Mar 2016, 12:41 AM

It is surprising that the validate function is not called on blur. This appears to make it impossible to disable buttons while invalid. Unfortunately, <button data-bind="disabled: field"> doesn't work though <input type="submit" data-bind="disabled: field"> does work.

I tried hacking this by calling validate() in a timer. The problem is the error msgs appear before the inputs have been dirtied.

Another issue is that Model inherits from Observable but binding a Model instance to a form causes exceptions. 

Another issue is I don't see a Model.validate() method or a way to bind a Model instance.

Is there a way to change tooltip position in the errorTemplate?

0
Rosen
Telerik team
answered on 18 Mar 2016, 07:34 AM

Hello ken,

I'm not sure I have understood the context of your question nor how it is related to the original thread's topic. Therefore, please open a separate support request in which to provide as much details as possible(a small sample will be appreciated) about the problem you are facing.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Validation
Asked by
jwize
Top achievements
Rank 1
Answers by
Rosen
Telerik team
ken
Top achievements
Rank 1
Share this question
or