I\'d like to validate a form using the jquery validate plugin, but I\'m unable to use the \'name\' value within the html - as this is a field also used by the server app. Sp
If you want add Custom method you can do it
(in this case, at least one checkbox selected)
in Javascript
var tags = 0;
$(document).ready(function() {
$.validator.addMethod('arrayminimo', function(value) {
return tags > 0
}, 'Selezionare almeno un Opzione');
$.validator.addClassRules('check_secondario', {
arrayminimo: true,
});
validaFormRichiesta();
});
function validaFormRichiesta() {
$("#form").validate({
......
});
}
function test(n) {
if (n.prop("checked")) {
tags++;
} else {
tags--;
}
}