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

Invalid dates on Kendo Editable grid

1 Answer 237 Views
Grid
This is a migrated thread and some comments may be shown as answers.
carlg
Top achievements
Rank 1
carlg asked on 24 Nov 2014, 01:24 PM
I am using an editable Kendo grid with a date picker.

Let's say the user manually enters an invalid date such as 12/2345/2014.

The Kendo code outputs a small message box below the grid row that says:

"<NameOfDateField> is not valid date"

If the user then navigates elsewhere or to a different screen, the grid reverts back to the last previous valid date.

So for example if the screen is opened and the date is 01/12/2014 and the user changes it to 12/111/2014, the error message will pop up and revert the date back to 01/12/2014.

Is there a way to suppress this message and allow the invalid date (12/111/2014) to be passed back to my controller (and not revert back to the last valid date), then I can handle it there?

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 26 Nov 2014, 12:17 PM
Hi carlg,

Basically, the validation is triggered due to the "data-val-date" attribute that the DatePicker's input has. Removing that attribute would allow you to enter invalid input, which would result in a DatePicker with a null value. Here is an example how to do that using the Grid's edit event: 
function onEdit(e) {
    e.container.find("[data-val-date]").removeAttr("data-val-date");
}

Regards,
Alexander Popov
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
carlg
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or