Wyświetlanie postów z luty, 2015

Validation using ASP.NET MVC + Kendo UI + jquery validate unobtrusive

I write one of my project in ASP.NET MVC with Kendo UI. I am using data annotations to emit client side validation rules. jquery.validate.unobtrusive.js picks them up and converts them into jquery validate rules. It works great for standard html inputs, but when inputs are wrapped with Kendo UI, input-validation-error class is assigned to wrong element. I was looking for solution to this problem, but didn't find really complete answer. Here is mine. First we have to adjust jquery validate to highlight appropriate elements in DOM: (function () { //This function checks if validated input is part of Kendo input and if it is, //it returns related Kendo element. Otherwise it returns itself. var findKendoElement = function (element) { //Pickers and numerics are built differently by Kendo, so we have to check. var parent = (element.parent().hasClass('k-picker-wrap') || element.parent().hasClass('k-numeric-wrap')) ? …