我正在使用bootstrapvalidator,它适用于以下内容。
$('.login-form').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
password: {
validators: {
notEmpty: {
message: 'The password is required and cannot be empty'
}
}
},
email: {
validators: {
notEmpty: {
message: 'The email is required and cannot be empty'
},
emailAddress: {
message: 'The input is not a valid email address'
}
}
}
}
});
我的提交操作向服务器提交了一个 ajax 请求,例如在 json 中回答
errors: {user: 'Username does not exist', password: 'wrong password'}
如何在 bootstrapvalidator 表单输入字段上手动触发这些服务器错误?