Is there a way to completely disable kendo validation?

4 posts, 0 answers
  1. Bostjan
    Bostjan avatar
    2 posts
    Member since:
    Dec 2014

    Posted 27 Jan 2015 Link to this post

    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? 
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 29 Jan 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Bostjan
    Bostjan avatar
    2 posts
    Member since:
    Dec 2014

    Posted 29 Jan 2015 in reply to Alexander Valchev Link to this post

    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
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 02 Feb 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready