I am facing a problom while using Bootstrap Validation in laravel. I have a input field that should be a number and must be grater than some value, Second thing is my input field can also be change with dropdown change option. It works fine after click on submit button. But when i change option from dropdown then submit button still unable to click, means it still disable. My code is
function c() {
var a = {
notEmpty: {
message: "You must set your price."
},
regexp: {
regexp: /^\d+([\.,]\d+(\.\d+)?)?$/i,
message: "Price must be a number."
},
greaterThan: {
value: 0
}
};
return a
}
var i = c();
$(".bv-form").bootstrapValidator({
fields: {
offer_price: {
trigger: 'change keyup',
validators: i
}
}
});
$(".create-bid-form button.submit").on("click", function(a) {
var b = $(".create-bid-form").data("bootstrapValidator");
b.isValid() && b.defaultSubmit(), b.validate();
}
After updating input value i also added this line
$("input[name=offer_price]").change();
But validation works only first time after click on submit button. Can somebody tell from where i am wrong. Thanks in advance.
I got the solution. I just add .change() event like
That worked for me. I hope it help to anyone.