Grid custom editor updates dataSource even when validation fails

3 posts, 0 answers
  1. azbola
    azbola avatar
    13 posts
    Member since:
    Jun 2007

    Posted 14 Nov 2013 Link to this post

    Hi there,

    I have a grid with a field with a custom editor.  This editor consists of an input field, and I have applied validation to this using the HTML5 attributes (required, min, etc). The field uses data-bind syntax to get/set the data.

    This works correctly and I get an error message when updating the field with invalid values.  
    However there appears to be a big flaw to how this works, the data-binding occurs BEFORE the validation it would seem.

    Even if I enter an invalid value. the change event still fires on the dataSource and the new invalid value is set.  
    This seems to me to be unwanted behaviour, if there is an invalid value I do not want this set in the datasource.

    Is this by design? How can I stop the data source updating on a validation failure?

    Thanks in advance,
    David Asbury.

    ps.  It is also possible to bypass the validator simply by pressing the escape key.  This kills the validation message and removes focus from the invalid control.   This also seems like a bug. 
  2. azbola
    azbola avatar
    13 posts
    Member since:
    Jun 2007

    Posted 15 Nov 2013 Link to this post

    Here is a jsFiddle that demonstrates this behaviour:
    http://jsfiddle.net/YFqNC/51/

  3. Kendo UI is VS 2017 Ready
  4. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 15 Nov 2013 Link to this post

    Hi azbola,

    Thank you for providing the sample. The behavior you have described is caused by the value binding declaration. When binding is specified there should be no space between the value: and the field name. This is required as the validation is executed via the attribute name thus will not work as expected in this case.
    Also you may know that there is no need to specify the value binding explicitly as the attribute will be generated automatically using the input element's name attribute. Here you can find a modified version of the jsfiddle you have sent us.

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