Author Topic: How to show validation message on focus change  (Read 2249 times)

[email protected]

  • Newbie
  • *
  • Posts: 5
    • View Profile
How to show validation message on focus change
« on: May 19, 2016, 06:50:52 pm »
hi ,
I need to show validation error message while editing in batch edit mode immediately after losing the focus on the corresponding cell i.e when i clicked outside the cell.
But it is happening now only when tab or enter is pressed , if keyUpDown: true it is giving for up and down arrow keys press also, But as i said i need it for losing the focus by clicking somewhere outside the cell.

I have used the following code

editModel: {
                    saveKey: $.ui.keyCode.ENTER,
                    keyUpDown: true
                   
                },

cellBeforeSave: function (evt, ui) {
                    var isValid = grid.isValid(ui);
                    if (!isValid.valid) {
                        evt.preventDefault();                       
                        return false;
                    }

                },

I added an extra line of code and changed it to be
cellBeforeSave: function (evt, ui) {
                    var isValid = grid.isValid(ui);
                    if (!isValid.valid) {
                        evt.preventDefault();
                        ui.alert();
                        return false;
                    }

                },
It is working fine how i wanted it to be, But the problem now is i am getting an uncaught error saying that
Uncaught TypeError: ui.alert is not a function
each and every time when validation error is being shown.

please help me solve this issue.