Model Configuration
beforeValidationOnUpdate()
Signature
Section titled “Signature”beforeValidationOnUpdate() — returns void
Available in: model
Category: Callback Functions
Description
Section titled “Description”Registers method(s) that should be called before 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. Register a single method to run before an existing object is validated on update
// Called inside the model's config() function
beforeValidationOnUpdate("sanitizeFields");
// 2. Register multiple methods as a comma-delimited list
beforeValidationOnUpdate("sanitizeFields,enforceBusinessRules");
// 3. Use the `method` argument alias for a single callback
beforeValidationOnUpdate(method="normalizeEmail");