Skip to content

Model Configuration

afterValidationOnUpdate()

afterValidationOnUpdate() — returns void

Available in: model Category: Callback Functions

Registers method(s) that should be called after an existing object is validated.

NameTypeRequiredDefaultDescription
methodsstringno—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).
// 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
    }
}