Integrate with Bootstrap framework. Support Bootstrap v4.3.1
TipUse the Bootstrap5 plugin if your form is made in Bootstrap v5
The following piece of code is the starting point to validate the form made in Bootsrap 4:
There are some important things here:
- The sample code above assumes that the FormValidation files are placed inside the
vendorsdirectory. You might need to change the path depending on where you place them on the server.
Bootstrap.min.jsis the plugin provided by FormValidation. It is NOT the same as
Bootstrap(.min).jsfile provided by Bootstrap framework.
The next sections list out some examples of various forms made with Bootstrap 4.
Form without label
Multiple fields on the same row
In order to add the correct class for error message and the field element when it is a valid or invalid, we need to specify the CSS selector of the field container.
By default, the Bootstrap plugin will look for the
.form-group element. In the following example, the
lastName fields are placed inside
.col-sm-4 containers. Meanwhile, the
zipcode fields can be found inside the
rowSelector option will be used to help the plugin determine the field containers as following:
- v1.5.0: Fixed the duplicated icons when using the Icon plugin with Bootstrap 4.3
- v1.0.0: First release