Registers method(s) that should be called to validate objects before they are saved.
Name | 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 | See documentation for validatesConfirmationOf. | |
unless | string | No | See documentation for validatesConfirmationOf. | |
when | string | No | onSave | See documentation for validatesConfirmationOf. |
<cffunction name="init"> <cfscript> // Register the `checkPhoneNumber` method below to be called to validate objects before they are saved validate("checkPhoneNumber"); </cfscript> </cffunction> <cffunction name="checkPhoneNumber"> <cfscript> // Make sure area code is `614` return Left(this.phoneNumber, 3) == "614"; </cfscript> </cffunction>