Validator not firing for custom popup editor

3 posts, 0 answers
  1. Sean
    Sean avatar
    79 posts
    Member since:
    May 2007

    Posted 25 Mar 2015 Link to this post

    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:

    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. Tim Weckx
    Tim Weckx avatar
    4 posts
    Member since:
    Jul 2012

    Posted 25 Mar 2015 in reply to Sean Link to this post

    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.
  3. Vladimir Iliev
    Vladimir Iliev avatar
    2156 posts

    Posted 27 Mar 2015 Link to this post

    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. 

    Vladimir Iliev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top