What's New With 3.3.0
2022-JAN-12
Nested Constraints
Nested structs can be validated using the constraints
or nestedConstraints
validator.
Using the nestedConstraints
validator requires the item it is used on be a struct. Otherwise a validation error will occur.
When using nestedConstraints
the field name of the errors will be the dot-delimited path of the target.
The field name change also applies to items
or arrayItem
validators.
The field name changes will allow you to match the validation errors to your fields in your forms. While cbValidation can nest constraints down as far as you'd like to go, remember that each nested level increases complexity.
Array and Struct Shorthand Syntax
To make defining array item and nested constraint validators easier, you can use a shorthand on the field name, like so:
Dot-delimited strings represent nested structs while the asterisk (*
) represents an array of items. This shorthand syntax is expanded to the equivalent syntax above before validating. Use whichever you prefer.
Validator Aliases
A few of the built-in validators now have an alias in addition to the long form validator name:
Co-authored by @garciadev
Added
Allow UDF and Method Validators to Utilize Error Metadata by @homestar9 (https://github.com/coldbox-modules/cbvalidation/pull/48)
Validator Aliases
Array and Struct Shorthand Syntax
Nested Constraints
Fixed
Date Comparisons Fail if Compare field is empty #58 thanks to @nockhigan: https://github.com/coldbox-modules/cbvalidation/pull/58
Last updated