Hi, I have a model with a date field, but in the form I collect the date through 3 separate dropdowns.
Is it possible to have some automation so I can build the date field from the 3 separate values in beforeSave() or beforeValidate() and if the validation fails, have the selected options be selected again on the form?
In beforeValidate() merge them or do what you need and put the result into the "date" property.
Add a validation rule for the "date" property.
In afterValidate() method you can check if there are any validation errors for this property (CModel.getError() method). If yes, then you can add 3 more errors for your separate fields (to highlight them in a form).
And also how do I get those custom attributes automatically populated from the form submission so I can use them to build the date in beforeValidate().
The attributes are named the same as the form fields.