I have a form that uses kendo-ui numericTextBox
@Html.LabelFor(p => p.Cost) @Html.TextBoxFor(p => p.Cost, new { @autocomplete = "off" })
I bind it to make it work with the jquery validate plugin, I set the following settings:
$("#Cost").kendoNumericTextBox({ format: "c", min: 0, decimals: 2 }); $.validator.setDefaults({ ignore: [], highlight: function (element, errorClass) { element = $(element); if (element.hasClass("k-input")) { element.closest(".k-widget").addClass(errorClass); } else { element.addClass(errorClass); } }, unhighlight: function (element, errorClass) { element = $(element); if (element.hasClass("k-input")) { element.closest(".k-widget").removeClass(errorClass); } else { element.removeClass(errorClass); } } });
When I try to submit a form and the Cost input is invalid, it correctly adds errorClass (on the .k .k-widget wrapper).
The problem is that if I press the submit button again, the kendo-ui element will just disappear (with style="display: none;" ).
I do not know what causes this. I saw that if I changed errorClass to something other than input-validation-error , then the kendo-ui widget will remain visible.
This problem occurs only with kendo-ui controls, as well as with standard html inputs.
Am I doing something wrong?
source share