Reputation: 7242
Alright this problem has been driving me a little crazy.
I have a checkbox on my form that looks like this:
<%=Html.CheckBox("Agreement", false)%>Yes, I agree to the terms
And then I have a js file that is loaded into the browser after jquery and jquery.validate are loaded that looks like this:
$.validator.setDefaults({
submitHandler: function() { alert("submitted!"); }
});
$().ready(function() {
// validate signup form on keyup and submit
$("#campForm").validate({
rules: {
Agreement: "required"
},
messages: {
Agreement: "Please accept our policy"
}
});
});
So reading the documentation this should work but it never does. What am I doing wrong?
Upvotes: 0
Views: 428
Reputation: 41442
I thought the syntax was supposed to be:
rules: {
Agreement: {required: true}
}
I could be wrong though. This is just off the top of my head.
Upvotes: 2