In order to integrate FormValidation with requirejs, perform the following steps:
- Copy all the files and folders of the
/dist/@form-validation/amd
folder to thewww/lib/@form-validation
folder
The www/lib/@form-validation
folder then will consist of the following files:
www
└── lib
└── @form-validation
├── bundle
├── core
├── locales
├── plugins-[PluginName]
├── styles
└── validators-[ValidatorName]
-
The
index.html
file contains the markup of the form that you want to validate -
The
www/app/main.js
file contains the validation script -
Open the
index.html
in your browser -
(Optional) To build an optimized version of the app, run the following command at the root folder:
$ node tools/r.js -o tools/build.js
The command creates an optimized version of the project in awww-built directory. The www-built/app.js
file will be optimized to include all of its dependencies.
You can open the www-built/index.html
in the browser.
For more information on the optimizer, please visit the requirejs' optimization page