One time the following validation code was working fine. If cartId did not exist, I received an error message from validationResults.getAllErrors()
`
validation = wireBox.getInstance(“ValidationManager@cbvalidation”);
// Set validation rules
constraints = {
cartId = {
required=true, requiredMessage=“Missing {field}.”,
type=“numeric”, typeMessage=“Invalid {field}.”
}
};
// Validate incoming data
validationResults = validation.validate(
target=args,
fields=structKeyList(constraints),
constraints=constraints
);
// Dump
writeDump(validationResults.getAllErrors());
`
But today, I got an exception:
Type: GenericObject.InvalidKey
Messages: The key requested ‘CARTID’ does not exist in the collection The valid keys are field1, field2…
I am running the app on Lucee 4.5.4.017 final and ColdBox 4.2.0.
Any idea what might be wrong?
Thank you!