I\'m trying to implement the code as mentioned in this post. In other words I\'m trying to implement unobtrusive validation on a terms and conditions checkbox. If the user
Sniffer,
In addition to implementing Darin's solution, you also need to modify the file jquery.validate.unobtrusive.js. In this file, you must add a "mustbetrue" validation method, as follows:
$jQval.addMethod("mustbetrue", function (value, element, param) {
// check if dependency is met
if (!this.depend(param, element))
return "dependency-mismatch";
return element.checked;
});
Then (I forgot to add this at first), you must also add the following to jquery.validate.unobtrusive.js:
adapters.add("mustbetrue", function (options) {
setValidationValues(options, "mustbetrue", true);
});
counsellorben