[coldbox-3.5.0] Validation framework and missing form fields

If I have a select list that allows multiple selections, or a check box on a form, and both are empty at the time of submission, the validation framework is throwing and error because they are defined in the config but they don’t exist in the RC.

The key requested ‘FormField’ does not exist in the collection

Does it make sense to have the validation framework first check for the existence of the form field, and if it’s not there param it and treat it as an empty string?


Good question, but you can param it in you handler anyway.

Yeah, that’s what I’m doing now - my problem is that I always forget to do it, and issues like this always seem to slip though our testing.

Yea I don’t think the validation should param your variables. That’s a controller concern

I don’t know if anyone is watching this old thread.

It shouldn’t param the value, but if a required value is missing from the request collection then it should give you a validation error when you call validateModel rather than throwing a “key requested does not exist in the collection”. It should check the defined fields in the config against the request collection, not the other way around. A missing value should be considered something that the user failed to enter in this case.