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

Validator not firing for custom popup editor

2 Answers 237 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 25 Mar 2015, 01:11 PM
I have a grid that is bound to a dataSource, and the dataSource has the required field validator set for several fields.  This works fine if I use the grid's built-in popup editor; if I leave a required field blank then I will get notified when I click "Update" in the popup editor.  However, if I use a custom popup editor (via kendo template) then the required field validation does not fire and I am able to save a blank value.

I have created a sample that exhibits this behavior:

http://dojo.telerik.com/oyuRe

If I modify my dataSource to include customValidation, that will fire in the custom popup editor but I don't think I should have to go down the path of defining a custom validation since the field is already marked as required in the dataSource (and it works when using the default popup editor).

This seems like a bug.  Is there any workaround?

2 Answers, 1 is accepted

Sort by
0
Tim Weckx
Top achievements
Rank 2
answered on 25 Mar 2015, 02:43 PM
You have to manually add the required attribute to your input element. Kendo Grid does not add validation attributes to custom templates. I believe the customValidation rules work because they get attached through jquery based on the input element name.
0
Vladimir Iliev
Telerik team
answered on 27 Mar 2015, 08:02 AM
Hi Sean,

Tim is correct - the "required" validation attribute should be manually added to the editor when custom editor is defined in order to enable the "required" validation (the validator validates only elements with that attribute against the "required" validation). On other hand the custom validation is executed against all editors inside the editor template which is the reason for current behavior. 

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Sean
Top achievements
Rank 1
Answers by
Tim Weckx
Top achievements
Rank 2
Vladimir Iliev
Telerik team
Share this question
or