Miscellaneous
validateOnCreate()
Signature
Section titled “Signature”validateOnCreate() — returns any
Description
Section titled “Description”Registers method(s) that should be called to validate new objects before they are inserted.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
methods | string | yes | — | See documentation for validate. |
condition | string | yes | — | See documentation for validatesConfirmationOf. |
unless | string | yes | — | See documentation for validatesConfirmationOf. |
Examples
Section titled “Examples”<cffunction name="init">
<cfscript>
// Register the `checkPhoneNumber` method below to be called to validate new objects before they are inserted
validateOnCreate("checkPhoneNumber");
</cfscript>
</cffunction>
<cffunction name="checkPhoneNumber">
<cfscript>
// Make sure area code is `614`
return Left(this.phoneNumber, 3) == "614";
</cfscript>
</cffunction>