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

Is there a way to completely disable kendo validation?

3 Answers 843 Views
Validation
This is a migrated thread and some comments may be shown as answers.
Bostjan
Top achievements
Rank 1
Bostjan asked on 27 Jan 2015, 04:28 PM
We're using angular and are also using angular's own validation support.

On a numeric text field such as this:

<input
                kendo-numeric-text-box="name1"
                type="number"
                name="name1"
                class="ehr-count-input"
                ng-model="countValue"
                ng-model-options="{ getterSetter: true, updateOn: 'default blur', debounce: {'default': 250, 'blur': 0}, allowInvalid: true}"
                k-options="countOptions"
                ng-readonly="model.getViewConfig().isReadOnly()"
                ng-class="::EhrLayoutHelper.computeFieldClass(model)"
                ng-hide="model.getViewConfig().isHidden()",
                ng-required="::model.isRequired()"
                min="10"
                >

Kendo's validation gets triggered because of min="10", which causes the number field to reset to 10 if a user types in a number lower than that. On submit, it also triggers the error messages that display next to the field, messing up the layout.

Please note that I DO NOT register kendo validator on the form element (or any other element via <form kendo-validator="validator" ng-submit="validate($event)" class="k-content"> or anything like that, yet validation triggers regardless.

Is there any way to turn it off completely and just let angular handle it? 

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 29 Jan 2015, 09:23 AM
Hi Bostjan,

There is no obvious reason for the validation to trigger if there is no Validator widget initialized.
Are you using the numeric text box in a Grid editor or in some other widget? Probably this is the reason for having a Kendo Validation.

In order to remove the validation you may destroy the Validator. Please specify where the numeric text box is used and I will show you how to disable the Validator.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bostjan
Top achievements
Rank 1
answered on 29 Jan 2015, 09:45 AM
Turns out the validation probably triggered because I was trying to turn it off incorrectly by accessing the validator object via $("form").kendoValidator(). That seemed to install the validator even without specifying it on the <form> tag.

I'm still having issues with how to prevent the resetting of the value to min (10 in the above example) on blur. This still happens even without the validation being triggered. Would actually destroying the validator object help with that? We would much rather allow the user to be able to input the wrong value and show the error message on submit than having the value quietly reset on blur, which the user might not even notice before clicking submit.

The input field is used inside an angular directive, something like this:

<form ng-cloak class="ehr-form" name="form" novalidate="novalidate" ng-submit="validateEhrForm($event)">
    <ehr-count></ehr-count>
</form>

Where ehr-count is a custom angular directive with the template that is basically the input field I pasted in the first post:

<input
                kendo-numeric-text-box="name1"
                type="number"
                name="name1"
                class="ehr-count-input"
                ng-model="countValue"
                ng-model-options="{ getterSetter: true, updateOn: 'default blur', debounce: {'default': 250, 'blur': 0}, allowInvalid: true}"
                k-options="countOptions"
                ng-readonly="model.getViewConfig().isReadOnly()"
                ng-class="::EhrLayoutHelper.computeFieldClass(model)"
                ng-hide="model.getViewConfig().isHidden()",
                ng-required="::model.isRequired()"
                min="10"
                >


Thanks
0
Georgi Krustev
Telerik team
answered on 02 Feb 2015, 08:22 AM
Hello Bostjan,

I answered to the support thread opened on the same subject. I will ask you continue our discussion there in order to avoid any duplication. Thank you for the understanding.

Regards,
Georgi Krustev
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
Bostjan
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Bostjan
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or