I am generating a list of elements on a page, and they all have validators attached to them. When I look in the HTML source, I see something like:
I think this will help.
<div class="editor-field">
@{ Html.EnableClientValidation(false); }
@Html.TextBoxFor(m => m.BatchId, new { @class = "k-textbox" })
@{ Html.EnableClientValidation(true); }
</div>
This worked better for me:
$('#Reference').rules('add', 'required');
$('#Reference').rules('add', 'remove');
$('#Reference').rules('add', { minlength: 2 });
I actually found a solution that fits my needs better. I can do the following:
$(function() {
var settngs = $.data($('form')[0], 'validator').settings;
settngs.ignore = ".ignore";
});
And with that i can 'toggle' any element that i want by adding or removing the classname ignore
from an element.