如何在键入BootstrapValidator时始终启用提交按钮?
答案 0 :(得分:4)
为了实现您的目标,来自bootstrapvalidator.com的follow this tutorial
$('#alwaysEnableButtonForm')
.bootstrapValidator({
...
})
.on('error.field.bv', function(e, data) {
if (data.bv.getSubmitButton()) {
data.bv.disableSubmitButtons(false);
}
})
.on('success.field.bv', function(e, data) {
if (data.bv.getSubmitButton()) {
data.bv.disableSubmitButtons(false);
}
});
答案 1 :(得分:0)
$('#validationForm').bootstrapValidator();
$('#validationForm').on('error.field.bv', function(e, data) {
// $(e.target) --> The field element
// data.bv --> The BootstrapValidator instance
// data.field --> The field name
// data.element --> The field element
data.bv.disableSubmitButtons(false);
});
$('#validationForm').on('success.field.bv', function(e, data) {
// e, data parameters are the same as in error.field.bv event handler
// Despite that the field is valid, by default, the submit button will be disabled if all the following conditions meet
// - The submit button is clicked
// - The form is invalid
data.bv.disableSubmitButtons(false);
});
答案 2 :(得分:0)
$('#site_ekle_form').data('bootstrapValidator').resetForm();