How to use additional plugins in formvalidation?
Hi,
May I know how to use below in theme?
I discovered they included additional file /vendors/formvalidation/dist/js/plugins/AutoFocus.min.js which is not included in theme, thanks.
Replies (1)
Hi,
Sorry for the late reply.
If you are using Gulp build you just need to edit tools/gulp.config.js and add required formvalidations as shown below:
formvalidation: {
{
styles: [
"{$config.path.common_src}/plugins/formvalidation/dist/css/formValidation.css",
],
scripts: [
"{$config.path.node_modules}/es6-shim/es6-shim.js",
"{$config.path.common_src}/plugins/formvalidation/dist/js/FormValidation.full.min.js",
"{$config.path.common_src}/plugins/formvalidation/dist/js/plugins/Bootstrap5.min.js"
],
}, For the webpack builder just edit
tools/webpack/plugins/plugins.js// FormValidation - Best premium validation library for JavaScript. Zero dependencies. Learn more:
window.FormValidation = require("@/src/plugins/formvalidation/dist/js/FormValidation.full.min.js");
window.FormValidation.plugins.Bootstrap5 = require("@/src/plugins/formvalidation/dist/amd/plugins/Bootstrap5.js").default; Then recompile your assets folder with Gulp or Webpack.
Please note that the build tools are required only in the development environment just to compile the assets when the source folder files are modified. In the hosting/server deployment, you will only need the compile assets, no need to install the build tools dependencies there.
Regards.