AngularJS required attribute

3 posts, 0 answers
  1. Peter Terkildsen
    Peter Terkildsen avatar
    16 posts
    Member since:
    Mar 2010

    Posted 19 Mar 2015 Link to this post

    Hi,

    I'm using the DropDownList-control in an AngularJS-form. I have the following code:
    <select name="Category" required="required" title="Vælg venligst en kategori" kendo-drop-down-list k-options="categoryOptions" ng-model="item.Category"></select>

    It works pretty fine and I'm able to save the data back to the server. However, as you can see I have added the required attribute to the input-element. This results in the following error message in the console:
    An invalid form control with name='Category' is not focusable.

    I guess that the reason for this is the fact that the input-element has a display:none and therefore the browser is not able to locate it. But is there some other method to handle this?

    Regards,

    Peter
  2. Holger
    Holger avatar
    77 posts
    Member since:
    Nov 2012

    Posted 20 Mar 2015 in reply to Peter Terkildsen Link to this post

    Hi,

    you are right, it's because the select element is wrapped and the browser's native validation then fails. I would suggest to use the Kendo UI Validator which works fine with Kendo widgets. You will also gain a homogeneous visualization of validation over all browsers.

    Sample: Validator / AngularJS

    Regards,
    Holger
  3. Kendo UI is VS 2017 Ready
  4. Peter Terkildsen
    Peter Terkildsen avatar
    16 posts
    Member since:
    Mar 2010

    Posted 20 Mar 2015 in reply to Holger Link to this post

    Hi,

    Very cool! It works just as expected. :-)

    Thanks.

    Peter
Back to Top