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

AngularJS required attribute

2 Answers 319 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Peter Terkildsen
Top achievements
Rank 1
Peter Terkildsen asked on 19 Mar 2015, 02:26 PM
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 Answers, 1 is accepted

Sort by
0
Holger
Top achievements
Rank 1
answered on 20 Mar 2015, 05:49 AM
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
0
Peter Terkildsen
Top achievements
Rank 1
answered on 20 Mar 2015, 09:56 AM
Hi,

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

Thanks.

Peter
Tags
DropDownList
Asked by
Peter Terkildsen
Top achievements
Rank 1
Answers by
Holger
Top achievements
Rank 1
Peter Terkildsen
Top achievements
Rank 1
Share this question
or