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

Custom popup editor AngularJs Validation DropDownList

5 Answers 180 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 15 Mar 2016, 03:39 AM

Hi,

   I read many threads about validation in kendo UI, but I don't find what I'm looking for.  I have a grid with Custom Popup Editor and AngularJs like this example.  When I add a validation in the schema for my grid data source, User cannot save.  Because it is a dropdownlist with a default value, required validation does not work.  I tried this example for custom validation, but message is not shown.  I added this line in the template for popup editor:

<span class="k-invalid-msg" data-for="AssignmentType"></span>

It works for a simple textbox, but not for a dropdownlist.

Any ideas?

Note to Telerik Team:  There is many documentation everywhere very nice, but when we use dropdownlist in a grid, it is difficult to find the right way to go.

My two cents

Thank you

5 Answers, 1 is accepted

Sort by
0
Steve
Top achievements
Rank 1
answered on 15 Mar 2016, 05:52 AM

Hi,

   I found this solution here.  It works great except that I'm not in angular in the "onSave".  Is it possible to use angular in the save button (called from the custom popup editor) ?

 

Thank you

0
Rosen
Telerik team
answered on 18 Mar 2016, 07:50 AM

Hello Steve,

I'm not sure I understood what you mean by "Is it possible to use angular in the save button (called from the custom popup editor) ?" Could you please clarify?

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Steve
Top achievements
Rank 1
answered on 18 Mar 2016, 10:42 AM

Hi,

     I found a way to validate in the custom template popup editor (when I set value to dropdownlist to null, I have a message below).  However, when I click on Save button in this editor, nothing happen.  User does not know what is wrong.  So, I tried to manage onSave event on the grid to show a message with all validation errors, but it does not work, because I don't have access to $scope (angular).

 

Thank you

0
Accepted
Rosen
Telerik team
answered on 21 Mar 2016, 07:02 AM

Hello Steve,

You should be able to access the $scope in the save event depending on how your code is structured. However, you should be able to show custom validation without need to access the scope. Here is a modified version of the custom popup sample which demonstrates a possible implementation. Beside the custom rule you should note the added message placeholder and name attribute of the validated element.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Steve
Top achievements
Rank 1
answered on 22 Mar 2016, 01:15 AM

Thank you very much for your help. Even if validation was working when I clicked in the dropdownlist (using input.is("[data-bind='value: AssignmentType']")), it was not shown on save click because I didn't put a name to control in the custom template.

Thank you

Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Answers by
Steve
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or