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

Disable automatic validation

10 Answers 3414 Views
Validation
This is a migrated thread and some comments may be shown as answers.
Maxim Konstantinovski
Top achievements
Rank 1
Maxim Konstantinovski asked on 14 Mar 2012, 06:32 PM
Is there a way  to disable automatic validation? I want to validate manually by calling [validate()]. At present it creates red box around my input automatically when [blur] event is fired.
Thanks,
Max

10 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 15 Mar 2012, 09:21 AM
Hello Maxim,

KendoUI Validator will automatically trigger validation only if it is hooked to a form element and the form is submitted. However, from the description you have given, it seems that the browsers's built-in validation is triggered (most probably in FireFox?). You may remove the FireFox built-in validation highlighting  by overriding the appropriate CSS classes for example: 

input:invalid, input:-moz-ui-valid {
     box-shadow: none;     
}

Additional information on styling the browsers built-in validation can be found on the net, for example here.Greetings,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Brian Vallelunga
Top achievements
Rank 1
answered on 24 Mar 2012, 03:44 AM
Is this really the case? I'm seeing automatic validation as well with a custom validation rule. I'd like it to trigger only on calling the validate method.

Specifically, I'm validating if two fields are equal to one another, for password and password confirmation.
0
Rosen
Telerik team
answered on 26 Mar 2012, 09:14 AM
Hi Brian,

Could you provide a sample (using jsFiddle for example) test page in which the behavior can be observed.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Kjell
Top achievements
Rank 1
answered on 01 May 2012, 10:51 PM
In the demo site validation occurs on a field when you leave the field.

For example, click in the first field, then click out of it, and a validation message appears.

I'm not sure if Brian is asking about the same thing but I am interested in turning that off.
0
Rosen
Telerik team
answered on 02 May 2012, 04:22 PM
Hello Kjell,

You may prevent validation when input is blurred, by setting validateOnBlur option to false:

$("#div").kendoValidator({ validateOnBlur: false })

Greetings,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jark Monster
Top achievements
Rank 1
answered on 25 Feb 2013, 08:39 PM
Is there an easy way to replicate this on a grid?

I have 2 scenarios across multiple grids in my application I'd like to implement it for:

  1. Some columns needs to have validateOnBlur set to false
  2. All fields need to have it set to false

Let me know if this would be better suited as its own thread, but it seemed sufficiently related.

Thanks!

0
Rosen
Telerik team
answered on 26 Feb 2013, 09:02 AM
Hi,

I'm afraid that disabling the validation on blur is not supported.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jark Monster
Top achievements
Rank 1
answered on 08 Mar 2013, 04:44 PM
I found a work around for the grid not supporting disabling of validation on blur and figured I'd share it here.  It doesn't utilize validateOnBlur directly, but it does end up disabling it.

In the grid's onEdit event function:
.Events(e =>
{
    e.Edit("onItemGridEdit");
})
The function to turn off validation for a specific field:
function onItemGridEdit(e) {
    //if cell being edited is Description
    if (e.container.context.firstChild.id == "Description") {
        //turn off validation for this field (this time only)    
        e.sender.editable.validatable.validate = function ()
               { return true; };
        e.sender.editable.validatable.validateInput = function (input)
               { return true; };
    }
}
0
Parameswaran
Top achievements
Rank 1
answered on 22 Mar 2021, 10:26 PM
Can we enable the validation only on save button click in Edit grid popup instead of showing validation message onblur ?
0
Misho
Telerik team
answered on 25 Mar 2021, 10:36 AM

Hello,

Kendo validator has validateonblur configuration. It determines whether the validation will be triggered when element loses focus. The default value is true.

Here is a sample showing this approach: https://dojo.telerik.com/eViyozaG/2 

I hope this helps.

Best Regards,
Misho
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Christian
Top achievements
Rank 1
Iron
commented on 21 Feb 2023, 09:32 AM | edited

Might be the wrong channel (apology for that) but its the only one I found which was somehow related. Since we use the @progress/kendo-angular-charts": "^6.0.1" is there something related to the kendo validator.

In general it has to do with this part of the code:

for (let property in options) {
    if (!inArray(property, state.excluded) && options.hasOwnProperty(property)) {
        const propValue = options[property];
        if (isFunction(propValue)) {
            needsEval = true;
            if (!dryRun) {
                options[property] = valueOrDefault(propValue(context), defaults[property]);
            }
        } elseif (isObject(propValue)) {
            if (!dryRun) {
                state.defaults = defaults[property];
            }
            state.depth++;
            needsEval = evalOptions(propValue, context, state, dryRun) || needsEval;
            state.depth--;
        }
    }
}

FYI: The extra data which we have are observables, and somehow the logic in the code has a issue with that. What we wonder is why all of those properties are interpreted and why in such a way that you can't extend the object - for our use case we need that.

Since we have some logic which binds additional properties kendo chart checkes those properties and causes errors:

zone.js:218 Uncaught TypeError: Cannot read properties ofundefined (reading 'error') at lift.js:13:1 at evalOptions (eval-options.js:22:55) at evalOptions (eval-options.js:29:1) at evalOptions (eval-options.js:29:1) at evalOptions (eval-options.js:29:1) at ScatterLineChart.evalPointOptions (scatter-chart.js:171:24) at ScatterLineChart.createPoint (scatter-chart.js:210:1) at ScatterLineChart.addValue (scatter-chart.js:108:1) at ScatterLineChart.traverseDataPoints (scatter-chart.js:286:1) at ScatterLineChart.render (scatter-chart.js:41:1)

TypeError: source.subscribe is not a function
    at http://localhost:4200/vendor.js:794928:16
    at http://localhost:4200/vendor.js:797878:28
    at evalOptions (http://localhost:4200/vendor.js:208189:97)
    at evalOptions (http://localhost:4200/vendor.js:208196:29)
    at evalOptions (http://localhost:4200/vendor.js:208196:29)
    at evalOptions (http://localhost:4200/vendor.js:208196:29)
    at ScatterLineChart.evalPointOptions (http://localhost:4200/vendor.js:206514:76)
    at ScatterLineChart.createPoint (http://localhost:4200/vendor.js:206553:29)
    at ScatterLineChart.addValue (http://localhost:4200/vendor.js:206451:26)
    at ScatterLineChart.traverseDataPoints (http://localhost:4200/vendor.js:206629:17)
Is it possible we get any workaround here so in future we allow additional properties?

Edited: Resolved the issues by adding content as the parent property so its excluded. Would be nice if we had a property called metaData so there are no conflicts.
Tags
Validation
Asked by
Maxim Konstantinovski
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Brian Vallelunga
Top achievements
Rank 1
Kjell
Top achievements
Rank 1
Jark Monster
Top achievements
Rank 1
Parameswaran
Top achievements
Rank 1
Misho
Telerik team
Share this question
or