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

ng-required issue

9 Answers 283 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Elliot
Top achievements
Rank 1
Elliot asked on 26 Apr 2016, 01:32 AM

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?

9 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 27 Apr 2016, 06:15 PM
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!
 
0
Elliot
Top achievements
Rank 1
answered on 27 Apr 2016, 07:48 PM

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.

0
Elliot
Top achievements
Rank 1
answered on 27 Apr 2016, 07:54 PM
Please also keep in mind the required is based on the showEmployee variable in the controller.
0
Alexander Valchev
Telerik team
answered on 02 May 2016, 07:26 AM
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!
 
0
Elliot
Top achievements
Rank 1
answered on 04 May 2016, 02:00 PM
Please see: http://dojo.telerik.com/@eslater@simply-compliance.com/UBuGi for an example of ng-required not working.
0
Georgi Krustev
Telerik team
answered on 06 May 2016, 08:46 AM
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!
 
0
Elliot
Top achievements
Rank 1
answered on 10 May 2016, 07:33 PM
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?
0
Georgi Krustev
Telerik team
answered on 12 May 2016, 08:20 AM
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!
 
0
Elliot
Top achievements
Rank 1
answered on 12 May 2016, 01:58 PM
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.
Tags
DropDownList
Asked by
Elliot
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Elliot
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or