I've hit upon a problem with my newsletter checkboxes...I have two options sign up for one or other or both. Upon validating only the top checkbox receives the class="error" or class="valid" they both have the same name, however, when I check the bottom one it makes the top one valid. How can I include both checkboxes with the error/valid class as my error placement is shown by the checkbox borders turning red. Any help would be greatly appreciated.
html
<input type="checkbox" id="interested_in[future]" name="interested_in[]" value="future">
<input type="checkbox" id="interested_in[print]" name="interested_in[]" value="print">
jQuery
$(function(){jQuery.validator.setDefaults({
errorContainer: '.validation-advice',
errorPlacement: function(error, element) {
error.appendTo('.validation-advice');
},
});
$('#subscribe').validate({
rules: {
web_user_email: {
required: true,
email: true
},
"interested_in[]": {
required: true,
minlength: 1
}
}, etc.....
Aucun commentaire:
Enregistrer un commentaire