In order to integrate FormValidation with requirejs, perform the following steps:
- Copy all the files and folders of the
/dist/@form-validation/amdfolder to thewww/lib/@form-validationfolder
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.htmlfile contains the markup of the form that you want to validate -
The
www/app/main.jsfile contains the validation script -
Open the
index.htmlin 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.jsThe 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