I am using the ORM module but manually creating my forms. I have a date of birth field in the database table which stores a MySQL date. I want to be able to get the user to select the day, month and year of their birth and validate this when the form validation runs and then format the date into a MySQL date before adding it to the row entry.
The latter is fine because I can get the post variable and create a string. However, when I try to add fields to be validated i.e. they are required, I get an error telling me the field isn't in my model. How do I update the $val object to use my date that I have strung together rather than a non existant field in my form? Alternatively, do I have to store day, month and year of birth as separate entities in the table? Or how do I add my own error to the validation error array if I separately test the DOB input and then want everything else to run too?
The Validation observer uses a fieldset with the name of the model class.
If you create that using Validation::forge('Model_Myclassname') and add your custom fields to it before the Validation observer is called, the observer should re-use that instance, and add the model's fields to it.
I haven't tried this myself, but looking at the code this should work.