Simply supplies jQuery Validation resources, depends on jQuery plugin. Use this plugin to avoid resource duplication and conflicts.
OverviewThis plugin supplies jQuery Validation resources, and depends on the jQuery plugin to include the core jquery libraries.Use this plugin in your own apps and plugins to avoid resource duplication and conflicts.
Note for developers working with this pluginStart from version 1.9, the source code of the plugin was stored at GitHub.This plugin just provides the resources and a tag to include them. It must not include tags to add new functionality or wrap jQuery Validation features.If you need a newer version of jQuery Validation than is currently available with this plugin you can update this plugin in grails SVN yourself. The original author has no desire to manage releases - provided you follow the clear conventions set out, all users of this plugin will be happy! Be my guest and release new versions as and when - just don't break anything for existing users. That means:
IMPORTANT: Make sure the version number of the plugin and the jQuery Validation distribution is the same.
- Always include all jQuery Validation resources such as jquery.validate.js, jquery.validate.pack.js and additional-methods.js.
- Don't add any functionality tags to this plugin
- Only update the jquery core library dependency when absolutely necessary, i.e. when jQuery Validation requires it.
ConventionsThe version number of this plugin must always follow the version number of the jQuery Validation version it bundled.E.g. the first release of this plugin is 1.7 - because it ships jQuery Validation 1.7. If jQuery Validation upgrades to 1.8 or similar, this plugin would need to be upgraded to use it and use the version number 1.8.The key part is that any apps/plugins can install or dependsOn "jqueryValidation" of a given version e.g. 1.7 to pull in that version of jQuery Validation.This plugin must dependsOn the minimum version of jQuery required by the jQuery Validation version. E.g. in this release that is jQuery 184.108.40.206 which is a separate grails plugin that also matches this versioning convention
ConfigurationAfter you installed the plugin, the following default configurations will append to your project's Config.groovy:
- jqueryValidation.minified = true
- jqueryValidation.cdn = false // false or "microsoft"
- jqueryValidation.additionalMethods = false
Start from version 1.9, no configurations will append to your project's Config.groovy as you are encourage to use the resources plugin.
Microsoft CDNIf yout want to load the resources from the Microsoft CDN (which makes a lot of sense for high traffic sites), you can specifiyjqueryValidation.cdn = 'microsoft'default: loading from CDN is disabled.
Additional Validation MethodsjqueryValidation.additionalMethods = true|falsedefault: additional-methods.js not served.
Using the resources framework (recommended)If you are using the Grails resources framework you simply include a "use" tag in your GSP or layout as normal and include the names of the modules you need. The modules exposed by this plugin are:
- jquery-validate - the packed jquery validate provided by the plugin
- jquery-validate-dev - the not minified JS
- jquery-validate-additional-methods - for additional Methods js
- jquery-validate-additional-methods-dev - the not minified JS