Hi folks,
I'm working with ASP.NET MVC 4 and KnockoutJS and I found this situation: I created a helper to retrieve all data-* attributes that JQuery Validation needs: Something like that:
<input class="required" data-bind="value: Nombre" data-val="true" data-val-length="The field Nombre must be a string with a maximum length of 10." data-val-length-max="10" data-val-required="The Nombre field is required." id="Nombre" name="Nombre" type="text" value="" />
The thing is that KnockoutJS makes JQuery Validation useless when It binds a model property into this field...
I tried to make a custom binding but It doesn't work either:
ko.bindingHandlers.validate = {
init: function (element, valueAccessor) {
var options = valueAccessor();
$(element).validate(options);
},
update: function (element, valueAccessor) {
var options = valueAccessor();
$(element).validate(options);
}
};
Also tried this case but this sample has the class="required" explicit and the rest of my rules doesn't work either.
Any solution for this case?
Thanks a lot and sorry for my English :)
Regards!