Probably really easy to do but im not quite sure the best way??? I’d like to manipulate and change my form data after validation and before save() using active record.
I have a custom function that validates the data. But then I get a conflict from the validation rules if I try to change it.
fibler, did you edit your first post, now providing an example? I didn’t notice before.
Perhaps I was wrong. Your other options are to call validate() yourself, do some processing, followed by save(false). If you just want to change what is written to the database you can use beforeSave().
Hey so I got it to work with if($model->validate()) and then save(false).
Thanks heaps for your help.
Also, I had a look more closely at behaviors and the available functions like beforeSave and afterValidate. The only thing is, im not exactly sure how to call a behavior from a controller when processing the form data.