i am rewriting my contact form plugin for CakePHP <= 2.2
In the model there are virtual fields only without database table.
For dynamic use, i need to add validation on the fly with $this->Model->validator()->add()
in the beforeFilter()
function.
This works, but I don't get any validation errors in the view.
They are stored in $this->Model->validationErrors
after calling $this->Model->validates()
only.
When I move the validation into the $validate
variable everything seems to work.
Flush messages and the "required" attributes in my input fields are set.
I think the problem is rendering the view before adding the validation rules to the model.
Any suggestions? Thank you