我在表格上有一些验证。我想补充一些其他验证。在firstname textfield中只允许使用字母文本。
在此jquery中仅为字母添加哪个关键字。
以下是验证表单的代码。
$("#validateForm").validate({
debug: false,
rules: {
firstname: {
required: true,
maxlength: 10
},
lastname: {
required: true,
maxlength: 10
},
contactmail: {
required: true,
email: true
},
jobtitle: "required",
username: {
required: true,
minlength: 2
},
password: {
required: true,
minlength: 5
},
repassword: {
required: true,
minlength: 5,
equalTo: "#password"
}
},
messages: {
firstname: {
required: "Please enter your firstname",
maxlength: "firstname must consist of below 10 characters"
},
lastname: {
required: "Please enter your lastname",
maxlength: "lastname must consist of below 10 characters"
},
contactmail: {
required: "Please enter email address",
email: "Email must be in the format of name@domain.com"
},
jobtitle: "Please enter job title",
username: {
required: "Please enter a username",
minlength: "Your username must consist of at least 2 characters"
},
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
},
repassword: {
required: "Please provide a retype password",
minlength: "Your password must be at least 5 characters long",
equalTo: "Please enter the same password as above"
}
},
});