ng-required issue

10 posts, 0 answers
  1. Elliot
    Elliot avatar
    59 posts
    Member since:
    May 2012

    Posted 25 Apr Link to this post

    I have the following dropdownlist:

    <select kendo-drop-down-list id="employee" name="employee"
        k-ng-model="incident.employeeId"
        ng-model="incident.selectedEmployee"
        ng-required="showEmployee"
        k-value-primitive="true"
        k-data-text-field="'fullName'"
        k-data-value-field="'employeeId'"
        k-option-label="{ employeeId: null, fullName: 'Select employee...'}"
        k-data-source="employeeDataSource">
    </select>

    In the controller ishowEmployee is set to true.

    The issue I have is that it wont mark it as required.  If I simply change the dropdownlist to a combo box it will mark it required.  Why and how do I get it as required when showEmployee is true?

  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 27 Apr Link to this post

    Hello Elliot,

    This help topic demonstrates how to create a required DropDownList in AngularJS application.

    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. Elliot
    Elliot avatar
    59 posts
    Member since:
    May 2012

    Posted 27 Apr in reply to Alexander Valchev Link to this post

    Three things:

    1. The fact that ng-required is working fine simply changing it to a kendo combo box tells me there is something not right with the drop down list.

    2. The drop down list should work with ng-required otherwise whats the point of the angular version of your controls.

    3. Changing it to just required still doesnt solve the problem.

    I am using v2016.1.412

    If you could do a quick dojo showing it working that would help.

  5. Elliot
    Elliot avatar
    59 posts
    Member since:
    May 2012

    Posted 27 Apr Link to this post

    Please also keep in mind the required is based on the showEmployee variable in the controller.
  6. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 01 May Link to this post

    Hi Elliot,

    The example from the help topic that I provided below works if you use a ng-required attribute.

    What is the difference in your case?

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  7. Elliot
    Elliot avatar
    59 posts
    Member since:
    May 2012

    Posted 04 May Link to this post

    Please see: http://dojo.telerik.com/@eslater@simply-compliance.com/UBuGi for an example of ng-required not working.
  8. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 06 May Link to this post

    Hello Elliot,

    The datasource is empty when the ng-required expression is evaluated. You will need to use model field that can be updated once the data source is populated. The same approach is shown in the AngularJS documentation: Check the modified demo:
    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  9. Elliot
    Elliot avatar
    59 posts
    Member since:
    May 2012

    Posted 10 May in reply to Georgi Krustev Link to this post

    I am getting a digest in progress error when I add the change event to my data source.  I can see it working fine in the demo but cant figure out what is causing it in my case.  The controller is very simple.  Any idea why this would happen?
  10. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 12 May Link to this post

    Hello Elliot,

    We will need a repro demo in order to continue with our investigation. Would it be possible to modify the demo I sent in my previous reply or send us a new one that demonstrates the issue?

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  11. Elliot
    Elliot avatar
    59 posts
    Member since:
    May 2012

    Posted 12 May in reply to Georgi Krustev Link to this post

    After way too much fiddling around the problem ended up being the k-option-label being an object.  It was causing all sorts of problems with required.   When I changed it to a string everything worked as expected.
Back to Top
Kendo UI is VS 2017 Ready