I'm searching for a way to validate fields that I add to a form after the DOM is loaded and $('#formId').bootstrapValidator()
is executed. Is there a way to add a new field and validate it when the form is submited?
I was also searching same thing and found solution HERE
However in my case i have destroy bootstrap obj and reinitialize.
$('#sign-up_area').bootstrapValidator('destroy');
$('#sign-up_area').data('bootstrapValidator', null);
$('#sign-up_area').bootstrapValidator();
There's now a much easier way to accomplish this, using the update
method of Bootstrap Validator:
$('#formId').validator('update')
From the docs:
Updates the collection of inputs that will be validated. Call this method if the set of fields which need to be validated has changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With