ValidateThis QuickStart Guide

Follow these simple steps to get started using the framework:

  1. Download the framework from validatethis.riaforge.org.
  2. Extract the framework files, which are in the /ValidateThis folder, and place them somewhere. If you place them in your web root you may skip step 3.
  3. Create a Mapping, named ValidateThis, that points to the location of the framework files.
  4. Copy the JavaScript files from /ValidateThis/client/jQuery/js/ into a folder that will be accessible by your web pages (e.g., /js/ off your web root).
  5. Create a Rules Definition File for a Business Object for which you want ValidateThis to generate validations. Take a look at the Sample Rules Definition File for an example.
  6. In your application code, create a ValidateThisConfig Struct, and then instantiate the ValidateThis.cfc facade object, passing in the struct, like so:
<cfset ValidateThisConfig = {JSRoot="/js/",definitionPath="/model/"} />
<cfset application.ValidateThis = createObject("component","ValidateThis.ValidateThis").init(ValidateThisConfig) />

Where:


More information on the keys that can be used in the ValidateThisConfig struct is available under Configuring the Framework.


You will now be able to call methods on the ValidateThis facade object to perform server-side and generate client-side validations.

For example, to perform server-side validations on an object, use the validate() method:

<cfset Result = application.ValidateThis.validate(myObject) />


To generate client-side validations, use the getValidationScript() method:

<cfset theScript = application.ValidateThis.getValidationScript(theObject=myObject) />
<cfhtmlhead text="#theScript#" />


For more information on interacting with the ValidateThis.cfc facade object, see the section on Using the ValidateThis Facade Object.


What's Next?

More info is available on:

 
Download in other Formats:
markup Markup | pdf PDF | swf SWF | html HTML | word Word

comments Comments (0)