Validation input data lost

3 posts, 1 answers
  1. zhivko.zhelezov
    zhivko.zhelezov avatar
    31 posts
    Member since:
    May 2011

    Posted 15 Jun 2016 Link to this post


    I have a datasource in which i have initialized a validation as this:

      minvaluevalidation: function (input) {

                                            if ("[name='minValue']")) {
                                                if ((parseFloat($("input[type='text'][name='minValue']").val()) > parseFloat($("input[type='text'][name='maxValue']").val()))) {
                                                    input.attr("data-minvaluevalidation-msg", "Min Value should be less than Max Value");
                                                    return false;

                                            return true;

    (also relative to maxvaluevalidation field)


    I have a grid to which this datasource is bound. The user can insert rows in this grid and everything works fine.

    Let's suppose I have typed for minValue the number 6 and then for maxValue the number 5.

    Then the minvaluevalidation function says 'false' there is a validation problem. Ok, I try to type 7 for the maxValue(bigger than 6) and click the 'update' button of the edit form of kendo. Here I know that this is valid and also the maxvaluevavlidation function returns true. But the 'update' or 'create' transport (CRUD operation) function has wrong data, there is no pair [6;7] there is pair [0;7] (or instead 0, the last valid typed number in grid) and the grid is updated with values 0 and 7....not with 6 and 7


    So when validation is broken for minValue, if I fix this for maxValue(not for minValue) and suddenly click 'update' while the validation message is still visible for minValue the data passed to the transport functions is wrong.

    Here If I try to change minValue to 3 and then again to 6 everything is updated and the transport function has right data, the grid has right data.






  2. Answer
    Stefan avatar
    1262 posts

    Posted 17 Jun 2016 Link to this post

    Hello Zhivko,

    When the validation for the minValue field fails the current value is not saved, that is why it is returning 0 or the last valid value.

    I can suggest the following:

    1) Wire the save event of the grid

    2) Get the latest values of the 'minValue' and 'maxValue' editors

    3) Update the model accordingly
    save: function(e) {
      var minValue= e.container.find("[name=minValue]").data().kendoNumericTextBox.value();
      var maxValue= e.container.find("[name=maxValue]").data().kendoNumericTextBox.value();
      e.model.set("minValue", minValue);
      e.model.set("maxValue", maxValue);

    Let me know if you need additional assistance.

    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  3. zhivko.zhelezov
    zhivko.zhelezov avatar
    31 posts
    Member since:
    May 2011

    Posted 18 Jun 2016 in reply to Stefan Link to this post

    Hello Stefan,

    thank you this works for me now fine



Back to Top