我的表单在用户开始输入的那一刻开始验证(使用这个插件)。例如,如果我输入了密码并重新输入密码,当输入密码的第一个字符时,它会立即显示“密码不匹配”,但用户没有机会输入重新输入的密码。
如何禁用输入验证并仅在用户单击提交时显示错误?有什么选择吗?
但是,带有远程检查的用户名我确实希望它在输入失焦时显示错误
$('#frm_user_details').formValidation('validate');
$('#frm_user_details').formValidation({
framework: 'bootstrap',
fields: {
register_first_name: {
validators: {
notEmpty: {
message: 'Please enter your first name'
}
}
},
register_last_name: {
validators: {
notEmpty: {
message: 'Please enter your last name'
}
}
},
username: {
validators: {
notEmpty: {
message: 'Please enter a username.'
},
remote: {
type: 'POST',
url: '/core/services/validator.php',
message: 'That username is already taken.',
delay: 500
}
}
},
register_password: {
validators: {
notEmpty: {
message: 'The password is required and cannot be empty'
},
identical: {
field: 'register_password_retyped',
message: 'The password and its confirm must be the same'
}
}
},
register_password_retyped: {
validators: {
notEmpty: {
message: 'The confirm password is required and cannot be empty'
},
identical: {
field: 'register_password',
message: 'The password and its confirm must be the same'
}
}
},
},
onError: function(e) {
e.preventDefault();
$('#create_account').removeClass('button-disabled');
},
onSuccess: function(e) {
e.preventDefault();
$('#create_account').addClass('button-disabled');
THIS.services.submitHandler();
}
}
});