Hi,
Since we update to Kendo UI Complete v2012.3.1304 we start to have a problem on the data grids. The error message is always a empty string when the is a dropdownlist.
Inside the grid:
<select data-bind="value: GroupId" data-val="true" data-val-required="Erro message." id="GroupId" name="GroupId" class="k-invalid valid" aria-invalid="true">
<option>[Selecione]</option><option value="13">item1</option><option value="47">item2</option>
</select>
<div class="k-widget k-tooltip k-tooltip-validation k-invalid-msg field-validation-error"
style="margin: 0.5em;" data-for="GroupId" data-val-msg-for="GroupId" id="GroupId_validationMessage" role="alert"><span class="k-icon k-warning">
</span><div class="k-callout k-callout-n"></div>
</div>
function to get the list of erros:
var validator = $(this).kendoValidator().data("kendoValidator");
var val = validator.validate();
if (!val) {
var errors = validator.errors();
var errorList = [];
$.each(errors, function (key, value) {
errorList.push({ message: value });
return errorList;
});
}
function from kendo.web.min.js ->
_extractMessage: function (t, n) {
var i = this,
r = i.options.messages[n],
o = t.attr(g);
return r = e.isFunction(r) ? r(t) : r, a.format(t.attr(a.attr(n + "-msg")) || t.attr("validationMessage") || t.attr("title") || r || "", o, t.attr(n))
},
We start to debug kendo to identify the problem. We find out that executing this function, _extractMessage: , it returns a empty string because it generates a
attribute name like "data-val-number". To bybass the problem we change the attribute name from data-val-required" to "data-val-number" with jquery.
Before call $(this).kendoValidator().data("kendoValidator"); we run this this code:
$(this).find("select[data-val-required]").each(function (index) {
var message = $(this).attr("data-val-required");
$(this).removeAttr("data-val-required");
$(this).attr("data-val-number", message);
});
Can you help to find a better solution?
Since we update to Kendo UI Complete v2012.3.1304 we start to have a problem on the data grids. The error message is always a empty string when the is a dropdownlist.
Inside the grid:
<select data-bind="value: GroupId" data-val="true" data-val-required="Erro message." id="GroupId" name="GroupId" class="k-invalid valid" aria-invalid="true">
<option>[Selecione]</option><option value="13">item1</option><option value="47">item2</option>
</select>
<div class="k-widget k-tooltip k-tooltip-validation k-invalid-msg field-validation-error"
style="margin: 0.5em;" data-for="GroupId" data-val-msg-for="GroupId" id="GroupId_validationMessage" role="alert"><span class="k-icon k-warning">
</span><div class="k-callout k-callout-n"></div>
</div>
function to get the list of erros:
var validator = $(this).kendoValidator().data("kendoValidator");
var val = validator.validate();
if (!val) {
var errors = validator.errors();
var errorList = [];
$.each(errors, function (key, value) {
errorList.push({ message: value });
return errorList;
});
}
function from kendo.web.min.js ->
_extractMessage: function (t, n) {
var i = this,
r = i.options.messages[n],
o = t.attr(g);
return r = e.isFunction(r) ? r(t) : r, a.format(t.attr(a.attr(n + "-msg")) || t.attr("validationMessage") || t.attr("title") || r || "", o, t.attr(n))
},
We start to debug kendo to identify the problem. We find out that executing this function, _extractMessage: , it returns a empty string because it generates a
attribute name like "data-val-number". To bybass the problem we change the attribute name from data-val-required" to "data-val-number" with jquery.
Before call $(this).kendoValidator().data("kendoValidator"); we run this this code:
$(this).find("select[data-val-required]").each(function (index) {
var message = $(this).attr("data-val-required");
$(this).removeAttr("data-val-required");
$(this).attr("data-val-number", message);
});
Can you help to find a better solution?