Model Configuration
afterValidationOnCreate()
Signature
Section titled “Signature”afterValidationOnCreate() — returns void
Available in: model
Category: Callback Functions
Description
Section titled “Description”Registers method(s) that should be called after a new object is validated.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
methods | string | no | — | Method name or list of method names that should be called when this callback event occurs in an object’s life cycle (can also be called with the method argument). |
Examples
Section titled “Examples”// 1. Call a single method after a new object is validated on create
component extends="Model" {
function config() {
afterValidationOnCreate("assignDefaults");
}
private function assignDefaults() {
if (!Len(this.role)) {
this.role = "member";
}
}
}
// 2. Call multiple methods after validation on create (comma-delimited list)
component extends="Model" {
function config() {
afterValidationOnCreate("sanitizeFields,logNewRecord");
}
}
// 3. Use the singular `method` alias for clarity
component extends="Model" {
function config() {
afterValidationOnCreate(method="trimWhitespace");
}
}