Return to v1.4.5 docs

validateOnCreate()



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

Name Type Required Default Description
methods string No See documentation for validate.
condition string No See documentation for validatesConfirmationOf.
unless string No See documentation for validatesConfirmationOf.
<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>