validate()

Description

Registers method(s) that should be called to validate objects before they are saved.

Function Syntax

validate([ methods, if, unless ])

Parameters

Parameter Type Required Default Description
methods string No Method name or list of method names to call (can also be called with the method argument).
if string No String expression to be evaluated that decides if validation will be run (if the expression returns true validation will run).
unless string No String expression to be evaluated that decides if validation will be run (if the expression returns false validation will run).

Examples

<cffunction name="init">
    <!--- Register the `check` method below to be called to validate objects before they are saved --->
    <cfset validate("check")>
</cffunction>

<cffunction name="check">
</cffunction>