Follow these simple steps to get started using the framework:
<cfset ValidateThisConfig = {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#" />
Note that for many of the built-in validation types you'll also have to include some initialization Javascript which is generated by calling the getInitializationScript() method:
<cfset initScript = application.ValidateThis.getInitializationScript() /> <cfhtmlhead text="#initScript#" />
Also note that the use of cfhtmlhead above is just a way of illustrating that you need to place the results of those method calls into your generated html in some way. You do not have to use cfhtmlhead to do that.
For more information on interacting with the ValidateThis.cfc facade object, see the section on Using the ValidateThis Facade Object.
More info is available on: