Model Configuration
afterValidationOnUpdate()
Signature
Section titled “Signature”afterValidationOnUpdate() — returns void
Available in: model
Category: Callback Functions
Description
Section titled “Description”Registers method(s) that should be called after an existing 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 an existing object is validated on update
// In models/User.cfc:
component extends="Model" {
function config() {
afterValidationOnUpdate("stampUpdatedBy");
}
private function stampUpdatedBy() {
this.updatedBy = request.currentUserId;
}
}
// 2. Register multiple methods to run after an existing object is validated on update
component extends="Model" {
function config() {
afterValidationOnUpdate("normalizeSlug,logValidation");
}
private function normalizeSlug() {
this.slug = LCase(Replace(this.title, " ", "-", "all"));
}
private function logValidation() {
// custom logging logic here
}
}