Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
feature
: Added constraintProfiles
to allow you to define which fields to validate according to defined profiles: https://github.com/coldbox-modules/cbvalidation/issues/37
feature
: Updated RequiredUnless
and RequiredIf
to use struct literal notation instead of the weird parsing we did.
feature
: Added the Unique
validator thanks to @elpete!
improvement
: Added null
support for the RequiredIf,RequiredUnless
validator values
In this section you will find the release notes for each version we release under this major version. If you are looking for the release notes of previous major versions use the version switcher at the top left of this documentation book. Here is a breakdown of our major version releases.
Upgraded to leverage the new cbi18n v2.x module. New CFML engine compatiblities and moving to modernland!
Complete rewrite to script and including tons of new validations, rules and conventions. It also ended the era of ACF11 and Lucee 4.5 support.
Initial awesome release!
No more manual discovery of validators, automated registration and lookup process, cleaned lots of code on this one!
New Validator: Accepted
- The field under validation must be yes, on, 1, or true. This is useful for validating "Terms of Service" acceptance.
New Validator: Alpha
- Only allows alphabetic characters
New Validator: RequiredUnless
with validation data as a struct literal { anotherField:value, ... }
- The field under validation must be present and not empty unless the anotherfield
field is equal to the passed value
.
New Validator: RequiredIf
with validation data as a struct literal { anotherField:value, ... }
- The field under validation must be present and not empty if the anotherfield
field is equal to the passed value
.
Accelerated validation by removing type checks. ACF chokes on interface checks
Consistency on all validators to ignore null or empty values except the Required
validator
Formatting consistencies
Improve error messages to describe better validation
Get away from evaluate()
instead use invoke()
Bugs
: Fixed lots of wrong type exceptions
Compat
: Remove ACF11 support
2021-MAY-15
New validator: ArrayItem
which can validate an array's items and make sure all the items pass validation against a specific constraints schema.
New validator: DateEquals
which can help you validate that a target value is a date and is the same date as the validation date or other field
New validator: After
which can help you validate that a target value is a date and is after the validation date
New validator: AfterOrEqual
which can help you validate that a target value is a date and is after or equal the validation date
New validator: Before
which can help you validate that a target value is a date and is before the validation date
New validator: BeforeOrEqual
which can help you validate that a target value is a date and is before or equal the validation date
New onError( closure ), onSuccess( closure )
callbacks that can be used to validate results using the validate()
method and concatenate the callbacks.
New assert()
helper that can assit you in validating truthful expressions or throwing exceptions
Two new helpers: validateIsNullorEmpty()
and validateHasValue()
so you can do simple validations not only on objects and constraints.
RequiredIf, RequiredUnless
can now be declared with a simple value pointing to a field. Basically testing if anotherField
exists, or unless anotherField
exists.
New BaseValidator
for usage by all validators to bring uniformity, global di, and helpers.
The IValidator
removes the getName()
since that comes from the BaseValidator
now.
The UniqueValidator
now supports both creation and update checks with new constraints.
Removed hard interface requirements to avoid lots of issues across CFML engines. Moved them to the interfaces
folder so we can continue to document them and use them without direct compilation.
Metadata for arguments did not have the right spacing for tosn of validators.
Added the missing rules
struct argument to several validators that missed it.
This is a major release as we have updated the internal cbi18n library from v1.x to v2.x and bringing compatibility issues on how you declare your localization settings in ColdBox. Please see the compatibility guide here on how to update your localization settings. (https://coldbox-i18n.ortusbooks.com/intro/release-history/whats-new-with-2.0.0#compatibility-updates)
If you are not using localization, then this is a seamless upgrade to you.
2022-JAN-12
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.
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.
A few of the built-in validators now have an alias in addition to the long form validator name:
Co-authored by @garciadev
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
Date Comparisons Fail if Compare field is empty #58 thanks to @nockhigan: https://github.com/coldbox-modules/cbvalidation/pull/58