You absolutely cannot put any of the .validate()
method options inside of the .rules()
method. Only rules (and messages
) can go inside of this.
$("#" + enums.RegisterUsername).rules("add", {
required: true,
minlength: 6,
alphanumericwithbasicpunc: true,
remote: SignUp.DuplicateUserIdCheckUrl,
messages: {
required: "<span style='color:red'> Required</span>",
minlength: "<span style='color:red'>User name must be at least 6 characters in length.</span>",
alphanumericwithbasicpunc: "<span style='color:red'>User name cannot contain the following characters: &,\, /, #, <, or >.</span>",
remote: "<span style='color:red'>User name already taken by another user.</span>"
}
});
Also, in every case, onfocusout
can never be set to true
. Validation on blur is already the default behavior so setting this option to true
can break the plugin. It can only be set to false
if you want to disable it, or set to a function to over-ride it. If you want validation to occur on blur, the onfocusout
option needs to be left out of .validate()
.
See the documentation: http://jqueryvalidation.org/validate/