kendo-multi-select & ng-required & ng-messages

6 posts, 0 answers
  1. Werner Haltner
    Werner Haltner avatar
    20 posts
    Member since:
    Jun 2006

    Posted 03 May Link to this post

    hello,

    i use the "kendo-multi-select" and i want to validate required values with ng-message.
    the problem is, that no one of the validation options (ng-pattern, ng-maxlength, etc) are triggered via ng-message and kendo-multi-select. even the simple "ng-required" is not accessible.

    is there another solution for this issue? or a workaround i can use?

    I use this one:

    <select kendo-multi-select
            id="{{x.Pos}}_{{$index}}"
            name="{{x.Pos}}_{{$index}}"
            style="width:100%"
            k-ng-model="x.something.Value"
            ng-disabled="!x.Editable"
            k-data-source="x.DataSource"
            k-ng-delay="x.DataSource"
            k-value-primitive="true"
            k-rebind="x.DataSource"
            ng-required="x.Required"
            autocomplete="off"></select>


    <div ng-messages="MyForm[x.Pos+'_'+$index].$error" ng-messages-multiple ng-if="MyForm[x.Pos+'_'+$index].$touched">
        <div ng-messages-include="/validationMessages.view.html"></div>
    </div>

     

    thank you for your help
    werner

     

  2. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    349 posts

    Posted 04 May Link to this post

    Hello Werner,

    You can use the Kendo UI Validator, as shown in the following demo:

    http://demos.telerik.com/kendo-ui/validator/angular

    You can find more information and API of the Validator in the following sections of our documentation:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/validator

    http://docs.telerik.com/kendo-ui/controls/editors/validator/overview

    Let us know if this helps.

    Regards,
    Dimiter Topalov
    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. Werner Haltner
    Werner Haltner avatar
    20 posts
    Member since:
    Jun 2006

    Posted 09 May Link to this post

    Dear Dimiter 

    I can't use the kendo validator - i must(!) use ngMessages. If it's not working with kendo - is there even a option to use both together?

    Regards Werner

  5. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    349 posts

    Posted 10 May Link to this post

    Hello Werner,

    In order to achieve the desired result, you will have to use ng-model instead of k-ng-model for binding. Please have in mind the following difference between the two approaches:

    http://docs.telerik.com/kendo-ui/AngularJS/introduction#scope-bindings

    ... as well as the fact that widgets initialized from the SELECT element do not reflect changes to the model field when ng-model for AngularJS 1.4.7+:

    http://docs.telerik.com/kendo-ui/AngularJS/Troubleshooting/common-issues#widgets-with-ng-model-directives-reflect-no-model-value

    Let me know if you have other questions about Kendo UI.

    Regards,
    Dimiter Topalov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. Werner Haltner
    Werner Haltner avatar
    20 posts
    Member since:
    Jun 2006

    Posted 11 May in reply to Dimiter Topalov Link to this post

    Dear Dimiter

    Thank you for your answer. Just to be clear and sure:

    A) you said i should use ng-model 
    AND 
    B) you also said, that ng-model will not reflect changes to ng-model

    for me, this sounds like a big contradiction. Do i understand your statement right?

    Regards
    Werner

  7. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    349 posts

    Posted 12 May Link to this post

    Hi Werner,

    I am sorry, the last part of my previous post was not clear enough. To sum up:

     - you need to use ng-model, if you want to use other Anglular validation directives (like ng-pattern, etc.)

    - there are two things you should have in mind when using ng-model instead of k-ng-model:

    http://docs.telerik.com/kendo-ui/AngularJS/introduction#scope-bindings
    (difference between ng-model and k-ng-model binding)

    and

    http://docs.telerik.com/kendo-ui/AngularJS/Troubleshooting/common-issues#widgets-with-ng-model-directives-reflect-no-model-value
    (explanation why ng-model does not work properly for AngularJS versions 1.4.9 and later, along with possible solutions).

    I hope this helps.

    Regards,
    Dimiter Topalov
    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