validateOnUpdate()
Description
Registers method(s) that should be called to validate existing objects before they are updated.
Function Syntax
validateOnUpdate([ methods, condition, 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.) |
condition |
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 existing objects before they are updated --->
<cfset validateOnUpdate("checkPhoneNumber")>
</cffunction>
<cffunction name="checkPhoneNumber">
<!--- Make sure area code is `614` --->
<cfreturn Left(this.phoneNumber, 3) is "614">
</cffunction>
